script.Parent.ClickDetector.MouseClick:connect(function() if script.Parent.SurfaceGui.TextLabel.Text == "______'s Creation Station" then local clicker = game.Players.LocalPlayer.Name script.Parent.SurfaceGui.TextLabel.Text = clicker.."'s Creation Station" elseif script.Parent.SurfaceGui.TextLabel.Text ~= "______'s Creation Station" then local gui = game.ServerStorage.alreadyClaimedGui:clone() gui.Parent = game.Players.LocalPlayer.PlayerGui gui.TextLabel:TweenPosition(UDim2.new(0.3,0,0.2,0), 'Out', 'Elastic', 2) wait(3) gui:Remove() end end)
Script above is in a normal script, parent tree looks like game>workspace>signTop>clickToClaim(this script)
It works perfectly fine in studio test mode, but whenever I load into a test server or into a real server, it doesn't work and I can't figure out why.
This isn't a ROBLOX bug. It has to do with FE and what scripts/localscripts have access to.
Server scripts cannot access the PlayerGui with FilteringEnabled; the same way LocalScripts can't access the ServerStorage
Also, normal scripts can't use LocalPlayer, which explains your error.
Use remote events.
Make a remote event in the ReplicatedStorage called "MakeAlreadyClaimedGui"
Put "alreadyClaimedGui" in ReplicatedStorage, not ServerStorage
Your Script
local claimed_re = game:GetService("ReplicatedStorage"):WaitForChild("MakeAlreadyClaimedGui") script.Parent.ClickDetector.MouseClick:Connect(function(player) -- that comes with the event. if script.Parent.SurfaceGui.TextLabel.Text == "______'s Creation Station" then script.Parent.SurfaceGui.TextLabel.Text = clicker.."'s Creation Station" elseif script.Parent.SurfaceGui.TextLabel.Text ~= "______'s Creation Station" then claimed_re:FireClient(player) end end)
LocalScript in StarterGui
local claimed_re = game:GetService("ReplicatedStorage"):WaitForChild("MakeAlreadyClaimedGui") claimed_re.OnClientEvent:Connect(function() local gui = game:GetService("ReplicatedStorage").alreadyClaimedGui:Clone() gui.Parent = script.Parent gui.TextLabel:TweenPosition(UDim2.new(0.3,0,0.2,0), 'Out', 'Elastic', 2) wait(3) gui:Destroy() end)
Also:
connect
is deprecated; use Connect
clone
is deprecated; use Clone
Remove
is deprecated; use Destroy()
LocalPlayer
- that is for LocalScripts.