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

How do I connect commands to move stuff?

Asked by 8 years ago

So how would I make commands to move stuff from Lighting to Workspace? Not asking you guys to do it for me but I dont understand how you connect chat to commands?

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
8 years ago

Well, you'd use the Chatted event to detect when a player says something, usually people cross-reference it against a permitted list, then perform the action! I'll give you a sample script!

local Permitted = {"Shawnyg","iSidersz"}

game.Players.PlayerAdded:connect(function(plr) -- When a player joins
    for i,v in pairs(Permitted) do
        if v:lower() == plr.Name:lower() then -- Check if they're on the list
            plr.Chatted:connect(function(msg) -- When they chat. Msg is what they say
                if msg:lower() == "hi" then
                    print('A permitted person said hi!')
                end
            end)
        end
    end
end)

The above script was not tested in-game. 95% sure there isn't an error, but if there is, it's a simple one.

Hope I helped!

0
thx iSidersz 70 — 8y
0
I always say this, but check by ID instead of by name since players can change their names. XAXA 1569 — 8y
0
@XAXA Good point, but I just did this really quick. @iSidersz Accept my answer! Shawnyg 4330 — 8y
Ad

Answer this question