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 » Scripting Helpers
Home Search
 

While true do (HELP)

Previous Thread :: Next Thread 
LordGando is not online. 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
MassiveGman is not online. MassiveGman
Joined: 23 Jan 2011
Total Posts: 2019
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 is not online. 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 is not online. 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
MassiveGman is not online. MassiveGman
Joined: 23 Jan 2011
Total Posts: 2019
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
MassiveGman is not online. MassiveGman
Joined: 23 Jan 2011
Total Posts: 2019
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
MassiveGman is not online. MassiveGman
Joined: 23 Jan 2011
Total Posts: 2019
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 is not online. 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 is not online. 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 is not online. 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
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
05 Jul 2013 09:11 PM
Set the characters parent to nil then.
Report Abuse
LordGando is not online. 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
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
05 Jul 2013 09:13 PM
Character=nil ~= Character.Parent=nil
Report Abuse
LordGando is not online. 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
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
05 Jul 2013 09:14 PM
But you are then in freecam.
Report Abuse
omaraa is not online. 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 is not online. 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
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
05 Jul 2013 09:22 PM
1: You are attempting to remove the player.

2: LoadCharacter cannot be accessed by LocalScript.
Report Abuse
btft is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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