generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Script won't work.... never seen this before in my life.

Previous Thread :: Next Thread 
FallenTacoz is not online. FallenTacoz
Joined: 05 Aug 2013
Total Posts: 328
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 is not online. 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 is not online. 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
FallenTacoz is not online. FallenTacoz
Joined: 05 Aug 2013
Total Posts: 328
08 Jun 2016 04:38 PM
How do I fix it?


shehmir ate the chaos emerald
Report Abuse
FallenTacoz is not online. FallenTacoz
Joined: 05 Aug 2013
Total Posts: 328
08 Jun 2016 04:39 PM
It used to work on my other game.


shehmir ate the chaos emerald
Report Abuse
Casualist is not online. 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
FallenTacoz is not online. FallenTacoz
Joined: 05 Aug 2013
Total Posts: 328
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image