|
| 10 Aug 2012 03:03 AM |
This is sort of a admin script but this is for a rp i'm doing. What it does is when you say "Chaos Control", you get teleported to a random location (Once I get more Vector3 values but for now, it's only one). The problem is that I have to test it in online mode since you can't use free chat in play solo mode on roblox studio. I tried it, went to play solo first to check the output and nothing showed. This is when the problem started. I went to my game and typed it but nothing happened. It shows nothing in the output like I said before but I can't verify this as you can use free chat in testing on roblox studio. Here's the script:
local isAdmin = {["Spongocardo"] = true, ["MarioKart333"] = true, ["j10adn"] = true} function findPlayer(name) for _, player in ipairs(game.Players:GetPlayers()) do if player.Name:lower() == name:lower() then return player end end end function onChatted(message, player) if message:sub(1, 13) == "Chaos Control" and isAdmin[player.Name] then game.Workspace[isAdmin].Torso.CFrame = CFrame.new(Vecotr3.new(-22.0000076, 26.6000004, -45)) end end
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) onChatted(message, player) end) end) |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 03:44 AM |
Also, I tried a local script but it wouldn't work (Obviously due to my uber failing :P) Gonna test it again and i'll get back. |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 03:50 AM |
"game.Workspace[isAdmin]"
There's your problem.
Also, you can start Play Solo and type this in in the command bar:
game.Players.LocalPlayer:SetSuperSafeChat(false) |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 04:03 AM |
local isAdmin = {["Spongocardo"] = true, ["MarioKart333"] = true, ["j10adn"] = true}
function findPlayer(name) for _, player in ipairs(game.Players:GetPlayers()) do if player.Name:lower() == name:lower() then return player end end end
game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(message) if message:sub(1, 13) == "Chaos Control" and isAdmin[player.Name] then plr.Torso.CFrame = CFrame.new(-22.0000076, 26.6000004, -45) end end) end) |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 04:04 AM |
Thanks for telling me how to turn off super safe chat in solo. Anyway, would I use this instead of "game.Workspace[isAdmin]"? game.Workspace:FindFirstChild(isAdmin) |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 04:11 AM |
@Iam Fixed a little flaw in you're script and tested. Not working, still shows no output and nothing happens. This is why I don't trust the wiki. |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 04:14 AM |
Torso is not a valid member of Player
Use Player.Character.Torso instead |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 04:16 AM |
| Spongo, what did you change? |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 04:24 AM |
@Iam There was another bracket needed on the last end. @OP Ok, will try |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 04:39 AM |
Got it working, used a script from the wiki and modified. I was wrong about the wiki... I'm so sorry! *Crys* |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 06:50 AM |
Scratch that, I need just one more piece of help. You guys know when I said that I would have more places to teleport. Well, I am using a math.random function which varies the teleportation location. All it does is break the script! No output, no nothing... Here's the script: local admins = {"Spongocardo","j10adn","MarioKart333"} function tableContains(t, value) for _, v in pairs(t) do if v == value then return true end end return false end function onChatted(message, player) if message == "Chaos control" and tableContains(admins, player.Name) then local m = math.random(1,2) if m == 1 then player.Character.Torso.CFrame = CFrame.new(-22.0000076, 26.6000004, -45) if m == 2 then player.Character.Torso.CFrame = CFrame.new(-91.2000046, 26.5999851, -1.99999905) end end
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) onChatted(message, player) end) end) end end
|
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 07:06 AM |
This part breaks the script:
if message == "Chaos control" and tableContains(admins, player.Name) then local m = math.random(1,2) if m == 1 then player.Character.Torso.CFrame = CFrame.new(-22.0000076, 26.6000004, -45) if m == 2 then player.Character.Torso.CFrame = CFrame.new(-91.2000046, 26.5999851, -1.99999905) end
You can't just place multiple "if"s and put one end for all of them.
You could do this, though, which is the proper way of it:
if message == "Chaos control" and tableContains(admins, player.Name) then local m = math.random(1,2) if m == 1 then player.Character.Torso.CFrame = CFrame.new(-22.0000076, 26.6000004, -45) elseif m == 2 then player.Character.Torso.CFrame = CFrame.new(-91.2000046, 26.5999851, -1.99999905) end end
Remember, there's another end for the function but I didn't include it here. |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 10 Aug 2012 07:10 AM |
You also messed up the connection line. Use this:
local admins = {"spongocardo" ,"j10adn", "mariokart333"}; local pos = {CFrame.new(-22, 26.6, -45), CFrame.new(-91.2, 26.6, -2)};
function isAdmin(nm) for _, a in pairs(admins) do if (a:lower() == nm:lower()) then return true; end end return false; end
game.Players.ChildAdded:connect(function (newPlayer) newPlayer.Chatted:connect(function (msg) if (not isAdmin(newPlayer.Name)) then return; end if (msg:lower():gsub(" ", "") == "chaoscontrol") then if (not newPlayer.Character) then return; end newPlayer.Character.Torso.CFrame = pos[math.random(1, #pos)]; end end); end); |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 07:37 AM |
| Tried both dr01 and the OP and they don't work. I've added the necessary adjustments but it still doesn't work. |
|
|
| Report Abuse |
|
|
| |
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 10 Aug 2012 08:05 AM |
| What did the output to mine say? |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 08:10 AM |
@dr01 It showed nothing in the output. That... is really spooky. |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 10 Aug 2012 08:10 AM |
O.o Try adding print itn to see how far it gets. |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 08:12 AM |
@dr01 So print(SCRIPT HERE)? |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 10 Aug 2012 08:15 AM |
No, like this:
local admins = {"spongocardo" ,"j10adn", "mariokart333", "player"}; local pos = {CFrame.new(-22, 26.6, -45), CFrame.new(-91.2, 26.6, -2)};
function isAdmin(nm) for _, a in pairs(admins) do if (a:lower() == nm:lower()) then return true; end end return false; end
game.Players.ChildAdded:connect(function (newPlayer) print(newPlayer.Name.." has entered the game"); newPlayer.Chatted:connect(function (msg) print(newPlayer.Name.." has said \""..msg.."\""); if (not isAdmin(newPlayer.Name)) then return; end print(newPlayer.Name.." is an admin"); if (msg:lower():gsub(" ", "") == "chaoscontrol") then print("Said the correct message"); if (not newPlayer.Character) then return; end print("Has a character"); newPlayer.Character.Torso.CFrame = pos[math.random(1, #pos)]; end end); end); |
|
|
| Report Abuse |
|
|
| |
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 10 Aug 2012 08:22 AM |
Lol yw
I think I know why... If you were testing start server/player, then the name of your player was "player" but he wasn't on the admin list.
|
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 08:22 AM |
| I tested on both online mode and start server/player. |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2012 08:44 AM |
| I thank you.This was really helpful.Play my game!!! |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
| |
|