This script works fine but if in a Local script it does’t work.
local clickable = true
function click ()
if clickable == true then
clickable = false
print("clicked")
script.Parent.Text = script.Parent.Reply.Text
wait(1)
clickable = true
end
end
script.Parent.MouseButton1Click:Connect(click)
Is this inside PlayerGui, or in the workspace?
That explains it oof
LocalScripts
cannot work if they’re parented inside the workspace, although I am wondering…What GUI exactly are you trying to work with here? A Billboard/SurfaceGui
in the workspace? Or something like a ScreenGui
for the Player to see on their screen?
LocalScripts only work in PlayerScripts (or ReplicatedFirst), so you would need to put them in StarterPlayerScripts. And ScreenGuis only work when parented to PlayerGui, so you would need to put them in StarterGui.
If you’re referring to the former, it says on the developer hub:
A LocalScript will only run Lua code if it is a descendant of one of the following objects:
- A Player’s
Backpack
, such as a child of a Tool
- A Player’s
character
model
- A Player’s
PlayerGui
- A Player’s
PlayerScripts
.
- The
ReplicatedFirst
service’
(Sorry, I missed a couple of others)
1 Like