|
| 30 May 2017 12:27 PM |
I'm not the best of scripters, so i kind of bundled together some scripts and wrote in the odd thing here and there, The overall idea of the script is to restrict a certain command, that teleports all players in the server to a certain position, I'd like some help on the restricting part, i've tried various methods and tried multiple online tutorials etc, but nothing has worked in my favour. Could someone please correct my script below.
I know that the teleporting part works, if that helps. -Thanks
local player = game:GetService("Players") local target = CFrame.new(-30.67,4.92,114.59) or CFrame.new(-25.87,4.92,114.39) or CFrame.new(-35.67,4.92,114.5) function si() for i, player in ipairs(game.Players:GetChildren()) do player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0) end end
function onChatted(msg, recipient, speaker)
local source = string.lower(speaker.Name) msg = string.lower(msg) end
local allow = ( player.Name == "potato12344" or player.Name == "Player" or player.Name == "Player2" or player.Name == "Player1" )
msg = string.lower(msg)
if (msg == "startinterviews" or "si") then if allow then si() elseif not allow then local screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent local textLabel = Instance.new("TextLabel") textLabel.Parent = screenGui textLabel.Position = UDim2.new(0, 25, 0, 50) textLabel.Size = UDim2.new(0, 150, 0, 50) textLabel.BackgroundColor3 = BrickColor.Red().Color textLabel.BackgroundTransparency = 1 textLabel.Text = "You can't use that command - Restricted to MR+" textLabel.TextColor3 = BrickColor.Red().Color end end function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) end
|
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 30 May 2017 12:37 PM |
local allow = ("potato12344","Player","Player2","Player1"}; local targets = { CFrame.new(-30.67,4.92,114.59); CFrame.new(-25.87,4.92,114.39); CFrame.new(-35.67,4.92,114.5); }
function si() for i, player in ipairs(game.Players:GetChildren()) do local target = targets[math.random(1,#targets)] player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0) end end
game.Players.PlayerAdded:Connect(function(plr) plr.Chatted:Connect(function(msg) local msg = msg:lower(); if msg == "startinterviews" or msg == "si" then for _,v in next,allow do if v == plr.Name then si() else local screenGui = Instance.new("ScreenGui") local textLabel = Instance.new("TextLabel") textLabel.Position = UDim2.new(0, 25, 0, 50) textLabel.Size = UDim2.new(0, 150, 0, 50) textLabel.BackgroundColor3 = BrickColor.Red().Color textLabel.BackgroundTransparency = 1 textLabel.Text = "You can't use that command - Restricted to MR+" textLabel.TextColor3 = BrickColor.Red().Color textLabel.Parent = screenGui screenGui.Parent = script.Parent end end end end) end)
R$33,025 |
|
|
| Report Abuse |
|
|
|
| 30 May 2017 01:12 PM |
| Its still unresponsive, when i type the command in chat it does nothing, as it did before.. |
|
|
| Report Abuse |
|
|
wjg999
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 95 |
|
|
| 30 May 2017 01:25 PM |
first off, put the gui stuff outside the loop because otherwise it would do the gui things for the times 3 times it isnt you. second, put a return after si() since nothing needs to be done in that function past that anyway. third, you say unresponsive.. no errors? does it even get called? if you dont know where it breaks you arent using enough prints. |
|
|
| Report Abuse |
|
|
|
| 30 May 2017 01:32 PM |
| Not a single error whatsoever, I'll see what i can do regarding prints and ill move the other stuff around like you said. |
|
|
| Report Abuse |
|
|
|
| 30 May 2017 01:53 PM |
| Alright the "si" function isn't defined, and line 25 (if v == plr.Name then) etc. isn't working either, any thoughts? |
|
|
| Report Abuse |
|
|
| |
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 30 May 2017 04:54 PM |
Either script is disabled or not running or you didn't try - I made an error on line 1.
Tables aren't defined w/ parenthasis
|
|
|
| Report Abuse |
|
|
|
| 31 May 2017 01:46 PM |
| Well could you fix that for me? |
|
|
| Report Abuse |
|
|
| |
|