In my test/modeling workspace I have a table that when you click it, it should change the text of a screen
And, it doesn't work..
Code:
local infoScreenTable = game.Workspace.InfoScreen.SurfaceGui.Table function onClicked() infoScreenTable.Text = "Big Table" end script.Parent.ClickDetector.MouseClick:connect(onClicked)
It is in a local script
I have concluded that you can't use a click detector in a localscript
For an actual locally seen part either activate FE
or Place the part into CurrentCamera
.
local infoScreenTable = workspace:WaitForChild("InfoScreen").SurfaceGui.Table script.Parent.ClickDetector.MouseClick:connect(function(player) infoScreenTable.Text = "Big Table" end)
Use a Server script
.
Try using this one :P this script is made to be a script thats inside the brick
local Detector = script.Parent -- The part where the clickdetector is inside local infoScreenTable = workspace:WaitForChild("InfoScreen").SurfaceGui.Table -- The location of the screen Detector.ClickDetector.MouseClick:connect(function(plr) -- Plr is the player thatclicks it infoScreenTable.Text = "Big Table" end)
I hope this worked for you!
Yes , it is but make sure that your event handler setup like this in case you want only certain players to see the text:
function onClick(player) infoScreenTable.Text = "Big Table" end