Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Cant set the text on local script?

Ok so i cant change a text in the script but theres no error. Heres the script:

local BES = game.StarterGui.ShopGui.BESystem.ClickBE
local Camera = game.Workspace.CurrentCamera
local plr = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	game.StarterGui.ShopGui.BESystem.CostLabel.Text = "Cost:5"
	Camera.CFrame = game.Workspace.ShpCams.Cam1.CFrame
	if plr.Tier.Value >= 1 then
		BES.Buy1.Disabled = true
		BES.Equip1.Disabled = false
		BES.Text = "Equip"
	else
		BES.Text = "Buy"
		BES.Buy1.Disabled = false
	end
end)

1 answer

✓ Accepted answer

Hello! I believe I see the error.

When a player joins, all GUIs in StarterGui get copied over to each players PlayerGui. This means you need to edit the PlayerGui instead. Try changing this! :)

local plr = game.Players.LocalPlayer
local BES = plr.PlayerGui.ShopGui.BESystem.ClickBE
script.Parent.MouseButton1Click:Connect(function()
	plr.PlayerGui.ShopGui.BESystem.CostLabel.Text = "Cost: 5"

If this doesn't work, let me know and I will try to solve it again.

4 comments

0

Thx

1

I also suggest adding WaitForChild("PlayerGui") line so that the script won't error.

0

Oh, yes. That is a very good suggestion!

0

Double Thx

This discussion is preserved as it was. New answers, comments, and votes are closed.