i'm making a Gui that pops up when you click on a brick.This is the script
script.Parent.MouseClick:Connect(function()
game.Players.LocalPlayer.PlayerGui.talk.enabled = true
end)
i'm making a Gui that pops up when you click on a brick.This is the script
script.Parent.MouseClick:Connect(function()
game.Players.LocalPlayer.PlayerGui.talk.enabled = true
end)
To make a script do something when a part is clicked, you need a ClickDetector. Also, you would make the gui invisible, then set it to visible (don't use ".Enabled" to make it appear).
Why you got the error you got: Scripts aren't the same as local scripts; you can only use "game.Players.LocalPlayer" on a local script.
alright thanks
if that brick is in workspace,
game.Players.LocalPlayer
would not work so it should look something like this (not tested):
script.Parent.MouseClick:Connect(function(plr)
plr:FindFirstChild("PlayerGui").talk.Enabled = true
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
is it a localscript? localplayer can only be called from a localscript