Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I fix this chat:connect LocalScript?

Asked by 6 years ago
local lumos = game.StarterPack.Wand.Handle.ParticlePart.Lumos

game.Players.LocalPlayer.Chatted(function(message)
    if message == "Lumos" then
        lumos.Enabled = true
    end
end)

It is in a LocalScript. What did I mess up?

0
a lot thehybrid576 294 — 6y

3 answers

Log in to vote
0
Answered by
LuaDLL 253 Moderation Voter
6 years ago
Edited 6 years ago

Make it a normal script inside of ServerScriptService

game.Players.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(message)
        local lumos = plr:WaitForChild("Backpack").Wand.Handle.ParticlePart.Lumos
     if message == "Lumos" then
          lumos.Enabled = true
      end
end)
end)

Ad
Log in to vote
0
Answered by 6 years ago

you forgot to add :connect inbetween Chatted and (function(message)

Log in to vote
0
Answered by
OfcPedroo 396 Moderation Voter
6 years ago
Edited 6 years ago

Check this out

game.Players.PlayerAdded:connect(function(player)
    plr.Chatted:connect(function(message)
    repeat wait() until player:WaitForChild("Backpack")
        local lumos = player.Backpack.Wand.Handle.ParticlePart.Lumos
     if message == "Lumos" then
          lumos.Enabled = true
      end
end)
end)

If this works, please mark as solved!

As always, keep the good scripting!

Answer this question