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

How come my admin commands won't work?

Asked by 9 years ago

So I am making admin commands and they work fine in roblox studio but when I try to use them in like Script Builder or My game they don't work...

Script:

local Admins = {["silverminer226"] = true, ["Player"] = true, ["RLuaScripting"] = true}

function onChatted(message, player)
    if message == "create/Part" and Admins[player.Name] then
       a = Instance.new("Part", workspace)
    end
end

game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(message) onChatted(message, player) end)
end)

I asked some people and they said it needed to be client sided and I have no clue how to do that xD

0
It means use a localscript ._. obcdino 113 — 9y
0
Don't work :P silverminer226 4 — 9y
0
You can't make it a LocalScript because it uses game.Players.PlayerAdded event. You need to record chats from the Local Player. Tigerism 220 — 9y
0
I'll try that. silverminer226 4 — 9y
0
There are some things that could be better but I see nothing that would prevent it working. Perci1 4988 — 9y

2 answers

Log in to vote
3
Answered by 9 years ago

Personally, I don't see why it needs to be client-sided. It is very limiting.

Also, I will make the script better/more efficient:

local admins = {
    [¨PlayerName¨] == true -- you dont need to do Player or your username, because this script does it for you
}

game.Players.PlayerAdded:connect(function(p)
    if admins[p.Name] or p.UserId == game.OwnerId then -- your userId is the same when youre Player
        p.Chatted:connect(function(msg)
            if msg == ¨create/part¨ then
                local a = Instance.new(¨Part¨)
                a.Parent = game.Workspace -- simply defining a local does not create a part, i think
            end
        end)
    end
end)

This should work.

0
Worked on roblox studio not on the game silverminer226 4 — 9y
0
Is this is a script in Workspace? and re-copy the code, I changed it TheDeadlyPanther 2460 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

I don't think so guys, About those Comments, As far as i know, I made this: http://www.roblox.com/Nathans-Simple-Admin-Commands-Script-item?id=322960285 "Local Won't really make it work, Since from what i know FilteringEnabled, it would only make it for that client, and not globally on the server." First. Does your game have FilteringEnabled Set to True or False? if False, I may not be able to help you, If true

Try the script i have there, Making the part code was correct. Just, Let's say, Maybe you want it to be positioned where the people stands at? Well, There goes the problem, You have to get a Vector3 of the Torso that the player Executed, and take its Location, and position the part to it. You did it using only Instance.new Which automatically positions them to the Vector 3 of 0,0,0

TL;DR The Code Sounds Right, But with Direct Instance.New, it's auto-positioned to 0,0,0

Excuse my English :P

0
I'll try this out :) silverminer226 4 — 9y

Answer this question