LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 05 Jul 2013 08:52 PM |
I have this script, when I say
game.Players.LordGando.Character=nil
It removes my character
when I say
game.Players.LordGando:LoadCharacter()
It loads back my Character
How can I make it so when I say on/ it removes my Character and when I say off/ it loads it back.
Also, is this local script or normal script.
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2013 08:54 PM |
game.Players.PLAYERNAME.Chatted:connect(function(msg)
if msg == "on/" then --code
elseif msg == "off/" then --code here
end
end)
|
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 05 Jul 2013 08:54 PM |
Help
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 05 Jul 2013 08:56 PM |
Okay I get it, but how do I make it so everybody can say it and it works for them. Here is what I got:
game.Players:Chatted:connect(function(msg)
if msg == "on/" then game.Players.Character=nil
elseif msg == "off/" then game.Players:LoadCharacter()
end
end)
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2013 08:57 PM |
player = PLAYERNAMEHERE
game.Players:findFirstChild(player).Chatted:connect(function(msg)
if msg == "on/" then Workspace:findFirstChild(player):Remove()
elseif msg == "off/" then
game.Players:findFirstChild(player):LoadCharacter()
end
end)
|
|
|
| Report Abuse |
|
|
|
| 05 Jul 2013 08:59 PM |
function chatted (player, msg) if msg == "on/" then player.Character:Remove()
elseif msg == "off/" then player:LoadCharacter() end end
game.Players.PlayerAdded:connect(function(pl) player.Chatted:connect(function(m) chatted(pl,m) end) end)
|
|
|
| Report Abuse |
|
|
|
| 05 Jul 2013 09:00 PM |
sorry, my bad.
function chatted (player, msg) if msg == "on/" then player.Character:Remove()
elseif msg == "off/" then player:LoadCharacter() end end
game.Players.PlayerAdded:connect(function(pl) pl.Chatted:connect(function(m) chatted(pl,m) end) end)
|
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 05 Jul 2013 09:04 PM |
I want it so everybody could say it, also shouldn't PLAYERNAME be in brackets.
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 05 Jul 2013 09:05 PM |
Sorry, I didn't see your new POST. Sorry.
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 05 Jul 2013 09:10 PM |
When I do :s game.Players.LordGando.Character=nil
I can move around freely while my character is Removed
So can I change the script a little, like this
function chatted (player, msg) if msg == "on/" then player.Character=nil -- Changed it here
elseif msg == "off/" then player:LoadCharacter() end end
game.Players.PlayerAdded:connect(function(pl) pl.Chatted:connect(function(m) chatted(pl,m) end) end)
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2013 09:11 PM |
| Set the characters parent to nil then. |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 05 Jul 2013 09:12 PM |
Thats what I did, XD. Look at my post.
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2013 09:13 PM |
| Character=nil ~= Character.Parent=nil |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 05 Jul 2013 09:14 PM |
Character=nil works fine for me :/
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2013 09:14 PM |
| But you are then in freecam. |
|
|
| Report Abuse |
|
|
omaraa
|
  |
| Joined: 23 Sep 2010 |
| Total Posts: 440 |
|
|
| 05 Jul 2013 09:22 PM |
Ok I am guessing you are making this script in a Normal script?
If so then: Make a local script and put it in StarterPack or what ever its call then put this code in the script: local player = game.Players.LocalPlayer
player.Chatted:connect(function(msg) If msg == "on/" then player:remove() elseif msg == "off/" then player:LoadCharacter() end end)
If not then: Remove the code you have and paste mine in, and make sure its in Starterpack. |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 05 Jul 2013 09:22 PM |
What do you mean
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2013 09:22 PM |
1: You are attempting to remove the player.
2: LoadCharacter cannot be accessed by LocalScript. |
|
|
| Report Abuse |
|
|
btft
|
  |
| Joined: 19 Feb 2011 |
| Total Posts: 1512 |
|
|
| 05 Jul 2013 09:25 PM |
local player = game:service'Players':WaitForChild("LordGando") player.Chatted:connect(function(c) if c=="on/" then if player.Character then player.Character:Destroy() elseif c=="off/" then player:LoadCharacter() end end end) |
|
|
| Report Abuse |
|
|
LordGando
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 6723 |
|
|
| 05 Jul 2013 09:31 PM |
Guys, script works. No more scripts XD
-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk |
|
|
| Report Abuse |
|
|