I am making a shop GUI
I want to whenever I click the gear for example first sword I want to change “Random Gear” text to Sword, but it is local script and I can not change with .text = Sword Please help me, thanks!
I am making a shop GUI
You have to put quotation marks.
Example:
workspace.part123.SurfaceGui.TextLabel.Text = "newText"
And I did put this in PlayerScripts to make sure it works in a local script, it does.
It’s actually really simple! You can use the code below and make some changes.
local player = game:GetService("Players").LocalPlayer
player.PlayerGui.ScreenGui.TextLabel.Text = "whathever you want"
local ImageButton = script.Parent
ImageButton.MouseButton1Down:Connect(function()
ImageButton.Parent.RandomGear.Text = 'Sword'
end)
You’ll have to mess around with the names of the objects since I have no idea what your hierarchy looks like
It does not work, it only works if it is regular script not local script sadly
Can you tell me if your script is a normal one or a local?
Edit: Okay nevermind i found out its a local one.
If it is a local script it should work normally, as GUIs only show to one player unless you make some RemoteEvents and ServerScripts.