Before you act like "You put in x but don't understand x? Well I got some stuff from a tutorial on the Dev hub and the rest I made myself. Whenever I put in the chat "spoopy" it doesn't work. What am I doing wrong"?
local announcer = Instance.new("Message") local function Joined(plr) -- Everytime they chat, we want to know plr.Chatted:Connect(function(msg) if msg == "spoopy" then -- Aha, that's our cue game.Lighting.Theboss:clone().Parent = game.Workspace announcer.Parent = game.Workspace announcer.Text = "Uh oh someone summoned something weird!" wait(3) announcer:remove() end end) end
The way you are using functions is not needed, however I am not saying it is bad practice. The way you are messing up is that you are never connecting the joined function to PlayerAdded.
game.Players contains a RBXScriptSignal named PlayerAdded. You need to use the Connect function of it and connect it to the Joined function.
game.Players.PlayerAdded:Connect(Joined)
Documentation can be found here for RBXScriptSignals and here for PlayerAdded.
Hope this helps.
Also, both Remove and Message are deprecated, so please look into that.
Edit: This can also be heavily spammed. Consider adding a debounce or some sort of whitelisting system to it. As of right now, it will allow you to say spoopy whenever you want and that boss will spawn. The first time it will say the message, however it will destroy your Message object, resulting in you being unable to see the message again, yet it will still spawn another boss.
remove and message is deprecated, so is hint in case you saw that somewhere. Also you didn't call Joined.
local announcer = Instance.new("Message") local function Joined(plr) -- Everytime they chat, we want to know plr.Chatted:Connect(function(msg) if msg == "spoopy" then -- Aha, that's our cue game.Lighting.Theboss:clone().Parent = game.Workspace announcer.Parent = game.Workspace announcer.Text = "Uh oh someone summoned something weird!" wait(3) announcer:remove() end end) end game.Players.PlayedAdded:Connect(function(p) Joined(p) end)
I would replace the message with prints so you can see them in the output.
local function Joined(plr) -- Everytime they chat, we want to know plr.Chatted:Connect(function(msg) if msg == "spoopy" then -- Aha, that's our cue game.Lighting.Theboss:clone().Parent = game.Workspace print("Uh oh someone summoned something weird!") end end) end game.Players.PlayedAdded:Connect(function(p) Joined(p) end)
If this helps then please click the Accept button, if it doesn't, write in the comments, Enjoy!