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

Server Script isn't changing the property of the Screengui in my game. Any suggestions?

I'm in the process of making a game about watching paint dry. Yes, it doesn't make sense. Anyhow, the majority of the script works, where if the player touches the wall when the timer hasn't reached 10 then they're automatically kicked from the game, and if they wait ten seconds then they touch the wall they aren't kicked. The problem I'm having is that when trying to enable the Screengui with the win text on it using the script it doesn't fire. There are no problems pertaining to this highlighted in the output.

local timer = 1
repeat
	timer = timer+1
	print("TestLine")
	wait(1)
until timer == 10
script.Parent.Touched:Connect(function(hit)
	if timer ~= 10 then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		player:Kick("You touched the paint. It was not dry.")
	else
		if timer == 10 then
			game.StarterGui.ScreenGui.Enabled = true --This is the part where I'm having problems
		end
	end
end)

Any help is appreciated. Some notes:

  • This is a server script, and not local.
  • I have tested this numerous times with the same result.

1 answer

You are changing the StarterGui, this is not what is displayed ingame. StarterGui just copies its contents into a player that joins. So changing it will only effect players who join after its changed.

To modify the active gui you need to change the PlayerGui contained in the player.

game.Players.LocalPlayer.PlayerGui...

Other then that the layout is the exact same.

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