So I came back to scripting and got some progress on some game. I'm trying to change text in a GUI to correspond with a value and it works in properties, but the text doesn't show on the GUI.
CODE:
local earned = false script.Parent.Touched:Connect(function() if earned == false then game.StarterGui.PointGUI.Value.Value = game.StarterGui.PointGUI.Value.Value + 1 game.StarterGui.PointGUI.TextLabel.Text = "Point Count: ".. game.StarterGui.PointGUI.Value.Value print("1") earned = true else print("Already gained") end end)
You are changing the property for the gui in the startergui, not the playergui. If a new player were to join, they would see the correct text, but it would not change. I would try
local earned = false script.Parent.Touched:Connect(function(hit) if hit.Parent.Parent:FindFirstChild("Humanoid") ~= nil then local plr = game.Players:FindFirstChild(hit.Parent.Name) if earned == false then plr.PlayerGui.PointGUI.Value.Value = plr.PlayerGui.PointGUI.Value.Value + 1 plr.PlayerGui.PointGUI.TextLabel.Text = "Point Count: ".. plr.PlayerGui.PointGUI.Value.Value print("1") earned = true else print("Already gained") end end end)
Well as coratite said You are changing the property for the gui in the startergui, not the playergui. but go to part that you want to touch the player to earn points then insert script(serverside). Type this lines.
-- Identifying variables local earned = false function touch(hit) if game.Players:FndFirstChild(hit.Parent.Name) ~= nil then player = game.Players[hit.Parent.Name] if not earned then -- you can use this but you can change the not earned to earned == false earned = true player.PlayerGui.PointGUI.Value.Value = player.PlayerGui.PointGUI.Value.Value + 1 player.PlayerGui.PointGUI.TextLabel.Text = "Point Count: "..player.PlayerGui.PointGUI.Value.Value print(1) earned = false else print("Already Gained") end end end
that it .Sorry for indentions and grammers but try it.