So I made this script which is supposed to wait for the player's GUI, but it keeps giving me this error: gyazo.com/8213f41dc0b4b3b58a61def9a5f3afd8 The game is Filtering Enabled. --Server Script--

local Gate = game.ReplicatedStorage.Folder.Gate
local StatFile = game.ServerStorage:WaitForChild("StatFile")

Gate.OnServerEvent:Connect(function(plr, data)
	if data == "Workout" then
    plr.PlayerGui:WaitForChild("HealthSystem")
    StatFile[plr.Name].Exp.Value = StatFile[plr.Name].Exp.Value + 5
	local Exp = StatFile[plr.Name].Exp.Value
	local MaxExp = StatFile[plr.Name].MaxExp.Value
	plr.PlayerGui.HealthSystem.Frame.ExpBar:TweenSize(UDim2.new(Exp/MaxExp,0,0.09,0))
	end
end)

4 comments

0

Are you sure HealthSystem is in the Player's PlayerGUI?

0

Yes HealthSystem in inside StarterGUI.

0

Is this a local script? And Where Is It Located?

0

Don't try to access or manipulate PlayerGui from the server.