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

Why won't this on chat script show the gui after it enables it?

The sound plays but the gui won't open at all. It enables in the gui but it won't show up for some reason.

function onChatted(msg, recipient, speaker) 

local source = string.lower(speaker.Name) 
msg = string.lower(msg) 

if (msg == "start") then 
game.Workspace.GameSounds.Buzzer:Play()
game.StarterGui.TeamPicker.Enabled = true
end 
end

function onPlayerEntered(newPlayer) 
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) 
end 

game.Players.ChildAdded:connect(onPlayerEntered) 

1 answer

you'd want to access the speaker's PlayerGui, not the game's StarterGui.

whatever is in StarterGui is replicated to the player's PlayerGui when they join.

function onChatted(msg, recipient, speaker) 

	local source = string.lower(speaker.Name) 
	msg = string.lower(msg) 

	if (msg == "start") then 
		game.Workspace.GameSounds.Buzzer:Play()
		source.PlayerGui.TeamPicker.Enabled = true
	end 
end

function onPlayerEntered(newPlayer) 
	newPlayer.Chatted:connect(function(msg, recipient) 
		onChatted(msg, recipient, newPlayer) 
	end) 
end 

game.Players.ChildAdded:connect(onPlayerEntered) 

2 comments

0

didn't work lol

0

fixed a typo, sorry

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