I'm new to scripting, so I'm not very good at this. I made this code out of what I do know about scripting, but it won't work.
function onClicked(mouse) game.StarterGui.ScreenGui.TextButton.Text = "hi" wait(5) game.StarterGui.ScreenGui.TextButton.Text = "x" end script.Parent.ClickDetector.MouseClick:connect(onClicked)
I'm not sure what's wrong with it, can soemone help me?
Hello! To do this, we will need something called a remote event. Just follow the following steps:
SETUP:
1)Create a remote event under ReplicatedStorage
-Name it "Clicked"
2)Create a local script under the text label you want to change.
4)Create a click detector under the part you want to get clicked
3)Create a server script under the part you want to to get clicked
SCRIPTING
SERVER SCRIPT:
EV = game:GetService("ReplicatedStorage"):WaitForChild("Clicked") script.Parent.ClickDetector.MouseClick:Connect(function() EV:FireAllClients() end)
LOCAL SCRIPT:
EV = game:GetService("ReplicatedStorage"):WaitForChild("Clicked") EV.OnClientEvent:Connect(function() script.Parent.Text = "hi" wait(5) script.Parent.Text = "x" end)
I hope this helps. With further questions/comments/concerns, feel free to reply to my post. ~mc3334