#BillboardGUI script
1 messages · Page 1 of 1 (latest)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local button = player:WaitForChild("PlayerGui"):WaitForChild("AskUI"):WaitForChild("Open")
local part = Workspace:WaitForChild("Rig"):WaitForChild("AskSystem"):WaitForChild("Part")
local touching = false
part.Touched:Connect(function(hit)
if hit:IsDescendantOf(character) then
touching = true
end
end)
RunService.RenderStepped:Connect(function()
if touching and not part:IsTouching(hrp) then
touching = false
end
button.Visible = touching
end)
sooo what's the problem
it doesnt appear
** You are now Level 6! **
I heard a ping someone typing to put a code inside, i dont see it tho
wait
here you are @winter brook :
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local button = player:WaitForChild("PlayerGui"):WaitForChild("AskUI"):WaitForChild("Open")
local part = Workspace:WaitForChild("Rig"):WaitForChild("AskSystem"):WaitForChild("Part")
-- Hide button by default
button.Visible = false
part.Touched:Connect(function(hit)
if hit:IsDescendantOf(character) then
button.Visible = true
end
end)
part.TouchEnded:Connect(function(hit)
if hit:IsDescendantOf(character) then
button.Visible = false
end
end)
also show us some directories about the ui, the model, the script etc.
yes
do you have anu print in the console of errors or wanrings?
nothing
ok I have a recommendation change this line:
local button = player:WaitForChild("PlayerGui"):WaitForChild("AskUI"):WaitForChild("Open")
to this:
local button = script.Parent.Parent
okay I did that
Visible is not a valid member of BillboardGui "Players.MonkeyTheBestYT.PlayerGui.AskUI"
ok wait
nope, the button called Open
ok wait
to show this you want to enable firstly the ui which means that i found the problem
** You are now Level 1! **
give me a minute
-- Hide button by default
button.Visible = false
part.Touched:Connect(function(hit)
if hit:IsDescendantOf(character) and not button.Visible then
button.Visible = true
end
end)
part.TouchEnded:Connect(function(hit)
if hit:IsDescendantOf(character) and button.Visible then
button.Visible = false
end
end)```
Try this
or probably add a debounce
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local button = scipt.Parent
local ui = script.Parent.Parent
local part = Workspace:WaitForChild("Rig"):WaitForChild("AskSystem"):WaitForChild("Part")
-- Hide button by default
button.Visible = false
ui.Enabled = false
part.Touched:Connect(function(hit)
if hit:IsDescendantOf(character) then
ui.Enabled = true
button.Visible = true
end
end)
part.TouchEnded:Connect(function(hit)
if hit:IsDescendantOf(character) then
ui.Enabled = false
button.Visible = false
end
end)
try one of those we sent and say if it is working
@winter brook
this one isnt working
I also corrected that typo
check this one by @coral jewel
Both didnt work
Remove the touch ended connection
or like comment it out
and test the Touched connection
-- Hide button by default
button.Visible = false
part.Touched:Connect(function(hit)
if hit:IsDescendantOf(character) then
button.Visible = true
end
end)
--part.TouchEnded:Connect(function(hit)
--if hit:IsDescendantOf(character) then
--button.Visible = false
--end
--end)
It still doesnt work, maybe its because the part is invisible?
try printing hit
see if it return anything when touched
nothing
ok so the part is never being touched
.Touched and .TouchEnded is unreliable asf
Okay so I realised when I play the game, the position of the part changes
Thats not the problem here, they ain't even firign
bruh
and now it just gets deleted when I play
is this a serverscript
check if its anchored 🤦♂️
its probably unanchored if its getting deleted out of nowhere
its is acnhored
is this a server script.
nvm fixed it
what was the problem?
I just changed a property in the part called Locked. Idk why was it on true and why was it making the script not work
I dont know what it does aswell
that don't make no sense
Locked just makes it so you can't click on the part through studio
Its weird, atleast its fixed