|
| 08 Jun 2016 04:17 PM |
Script:
wait(3) print("FallenTacoz Command Script Loaded") function onChatted(msg, recipient, speaker) local source = string.lower(speaker.Name) msg = string.lower(msg)
if (msg == ":training mode") then if speaker.Name == "FallenTacoz" or speaker.Name == "Player1" then game.Workspace.Message.Text = "Training mode activated." local p = game.Players:GetChildren() for i=1, #p do local gui = game.ServerStorage.GiveGui:Clone() gui.Parent = p[i].PlayerGui end game.Workspace.Doors.Parent = game.ServerStorage wait(2) game.Workspace.Message.Text = "" end end
if (msg == ":normal mode") or speaker.Name == "Player1" then if speaker.Name == "FallenTacoz" then game.Workspace.Message.Text = "Training mode de-activated." local p = game.Players:GetChildren() for i=1, #p do p[i].PlayerGui.GiveGui:remove() p[i]:LoadCharacter() end game.ServerStorage.Doors.Parent = game.Workspace wait(2) game.Workspace.Message.Text = "" end end
function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) end end game.Players.PlayerAdded:connect(onPlayerEntered)
Error:
16:15:06.535 - Attempt to connect failed: Passed value is not a function
???????????
shehmir ate the chaos emerald |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 08 Jun 2016 04:23 PM |
You're passing a nonfunction to :connect()
i.e. workspace.DescendantAdded:connect("Lol, this is not a function")
> 14:23:24.068 - Attempt to connect failed: Passed value is not a function |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 08 Jun 2016 04:25 PM |
In your case, onPlayerEntered is nil because the conditional: "if (msg == ":normal mode") or speaker.Name == "Player1" then" is false, so you don't define onPlayerEntered |
|
|
| Report Abuse |
|
|
|
| 08 Jun 2016 04:38 PM |
How do I fix it?
shehmir ate the chaos emerald |
|
|
| Report Abuse |
|
|
|
| 08 Jun 2016 04:39 PM |
It used to work on my other game.
shehmir ate the chaos emerald |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 08 Jun 2016 04:42 PM |
wait(3) print("FallenTacoz Command Script Loaded") function onChatted(msg, recipient, speaker) local source = string.lower(speaker.Name) msg = string.lower(msg) if (msg == ":training mode") then if speaker.Name == "FallenTacoz" or speaker.Name == "Player1" then game.Workspace.Message.Text = "Training mode activated." local p = game.Players:GetChildren() for i=1, #p do local gui = game.ServerStorage.GiveGui:Clone() gui.Parent = p[i].PlayerGui end game.Workspace.Doors.Parent = game.ServerStorage wait(2) game.Workspace.Message.Text = "" end end
if (msg == ":normal mode") or speaker.Name == "Player1" then if speaker.Name == "FallenTacoz" then game.Workspace.Message.Text = "Training mode de-activated." local p = game.Players:GetChildren() for i=1, #p do p[i].PlayerGui.GiveGui:remove() p[i]:LoadCharacter() end game.ServerStorage.Doors.Parent = game.Workspace wait(2) game.Workspace.Message.Text = "" end end
end
function onPlayerEntered(newPlayer) newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) end
game.Players.PlayerAdded:connect(onPlayerEntered) |
|
|
| Report Abuse |
|
|
|
| 08 Jun 2016 04:52 PM |
Thanks, it doesn't give me the error anymore but it's not doing anything and there's no error in the output log.. but thanks anyway!
shehmir ate the chaos emerald |
|
|
| Report Abuse |
|
|