Hello there, I have a LocalScript I made where the script is supposed to change the TextLabel like this:
"R0jym has rolled 4"
However it does not seem to work, as the output keeps saying that it's an error and the script keeps considering the PlayerName as a string, how do I remedy this? Thanks for any help
local player = game:GetService("Players").LocalPlayer local PlayerName = player.DisplayName local RS = game:GetService("ReplicatedStorage") local AnnounceEvent = RS:WaitForChild("AnnounceEvent") local text = player.PlayerGui.Announce.TextLabel local text2 = player.PlayerGui.Roll.TextLabel local button = player.PlayerGui.Roll.TextButton local value = player.PlayerGui.Roll.Value button.MouseButton1Click:Connect(function() text.Text = ..PlayerName 'has rolled '..text2.Text AnnounceEvent:FireServer() end)
local player = game:GetService("Players").LocalPlayer local PlayerName = player.DisplayName local RS = game:GetService("ReplicatedStorage") local AnnounceEvent = RS:WaitForChild("AnnounceEvent") local text = player.PlayerGui.Announce.TextLabel.Text --changed this for u local text2 = player.PlayerGui.Roll.TextLabel.Text --changed this too local button = player.PlayerGui.Roll.TextButton local value = player.PlayerGui.Roll.Value button.MouseButton1Click:Connect(function() text = PlayerName ..' has rolled '..text2 --this should work now AnnounceEvent:FireServer() end)
also, u have too many useless variables imo & consider using WaitForChilds when dealing with playerGui