Im editing an script that works for a touch brick function
script.Parent.Union.Enter.Touched:Connect(function(hit)
wait()
local plr = nil
if (GlobalCooldown) then return end
if game.Players:GetPlayerFromCharacter(hit.Parent) then
plr = game.Players:GetPlayerFromCharacter(hit.Parent)
Open(plr)
GlobalCooldown = true
wait(GlobalCooldownAmt)
GlobalCooldown = false
repeat wait(0.1) until plr:DistanceFromCharacter(script.Parent.Union.Position) > 15
end
end)
But i want it to work if you click a gui button, im doing this but dont work, please help
script.Parent.MouseButton1Up:Connect(function(clic)
wait()
local plr = nil
if (GlobalCooldown) then return end
if game.Players:GetPlayerFromCharacter(clic.Parent) then
plr = game.Players:GetPlayerFromCharacter(clic.Parent)
Open(plr)
GlobalCooldown = true
wait(GlobalCooldownAmt)
GlobalCooldown = false
repeat wait(0.1) until plr:DistanceFromCharacter(clic.Parent)
end
end)

3 comments
I changed what u said and still not working
Any errors? If not, try adding prints at each step and see where it goes wrong.
Nvm, I was doing something bad, thank you very much for the help, now it worked