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
 

Re: I don't understand why my scripts aren't working...

Previous Thread :: Next Thread 
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
03 Aug 2012 10:58 AM
I have 2 scripts that I just made, and they won't work! I wan't the first one to give the winners a fly Tool when they win, and the second one is supposed to give me a fly tool when I join the game. There's no Output from either of them, and here's the scripts:

--Made by Dozer86421
game.Players.PlayerAdded:connect(function(player)
player.TeamColor.Changed:connect(function()
if player.TeamColor == ("Bright red") then
local fly = game.Lighting.Fly
fly:Clone()
fly.Parent = player.StarterGear
player.Character.Humanoid.Health = 0
end
end)
end)

And the other one:

--Made by Dozer86421
game.Players.PlayerAdded:connect(function(player)
if player.Name == "Dozer86421" then
local fly = game.Lighting.Fly
fly:Clone()
fly.Parent = player.StarterGear
player.Character.Humanoid.Health = 0
end
end)

Can anyone help me with this? I have no clue why they won't work... :3
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
03 Aug 2012 11:01 AM
Bump. Can anyone help me?
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
03 Aug 2012 11:02 AM
game.Players.PlayerAdded:connect(function(player)
player.Changed:connect(function()
if player.TeamColor == BrickColor.new("Bright red") then
local fly = game.Lighting.Fly
fly:Clone()
fly.Parent = player.Backpack
pcall(function()
player.Character.Humanoid.Health = 0
end)
end
end)
end)

And the other one:

--Made by Dozer86421
game.Players.PlayerAdded:connect(function(player)
if player.Name == "Dozer86421" then
local fly = game.Lighting.Fly
fly:Clone()
fly.Parent = player.Backpack
pcall(function()
player.Character.Humanoid.Health = 0
end)
end
end)


If these are two scripts then I would but the second one in the first one since you already have the same event.
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 11:04 AM
Script 1:

--Made by Dozer86421
game.Players.PlayerAdded:connect(function(player)
player.TeamColor.Changed:connect(function()
if player.TeamColor == BrickColor.new("Bright red") then
local fly = game.Lighting.Fly
fly = fly:Clone()
fly.Parent = player.StarterGear
player.Character.Humanoid.Health = 0
end
end)
end)

Script 2:

--Made by Dozer86421
game.Players.PlayerAdded:connect(function(player)
if player.Name == "Dozer86421" then
local fly = game.Lighting.Fly
fly = fly:Clone()
fly.Parent = player.StarterGear
player.Character.Humanoid.Health = 0
end
end)
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
03 Aug 2012 11:05 AM
@cheater

What if the player is removed before is health turns to 0 HMM???? :#
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
03 Aug 2012 11:06 AM
Heh, dude, I don't know what a pcall is and if it's gonna fix my script, cool! But can I just change fly's Parent to player.StarterGear, because I kinda wanted them and me to keep them when we die. I'm just gonna go do that...
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
03 Aug 2012 11:07 AM
Yeah sure. Edit the script my friend :D
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 11:16 AM
@miz656

I am not expanding the script, I am only fixing it.
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 11:20 AM
also you forgot something in the script that will be a problem miz656


fixed script:

game.Players.PlayerAdded:connect(function(player)
player.Changed:connect(function()
if player.TeamColor == BrickColor.new("Bright red") then
local fly = game.Lighting.Fly
fly = fly:Clone()
fly.Parent = player.Backpack
pcall(function()
player.Character.Humanoid.Health = 0
end)
end
end)
end)

And the other one:

--Made by Dozer86421
game.Players.PlayerAdded:connect(function(player)
if player.Name == "Dozer86421" then
local fly = game.Lighting.Fly
fly = fly:Clone()
fly.Parent = player.Backpack
pcall(function()
player.Character.Humanoid.Health = 0
end)
end
end)
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
03 Aug 2012 11:21 AM
Actually, miz, you got the creator script right, just not the winner one.
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
03 Aug 2012 11:28 AM
The winner script does not work. The creator script for me does though!
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
03 Aug 2012 11:28 AM
But, I need both working. I don't want a half-working game. Well, that one script isn't even half the game, not nearly, but I still need the script fixed.
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 11:30 AM
Ok, post the new script so we can see the new problem.
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
03 Aug 2012 11:34 AM
What new script? I said the winner script wasn't working. -.- Maybe I said that there was a new script on accident. O.O Whatever... The winner fly Tool giving script isn't working. Here's the current version of it:

--Made by Dozer86421
game.Players.PlayerAdded:connect(function(player)
player.Changed:connect(function()
if player.TeamColor == BrickColor.new("Bright red") then
local fly = game.Lighting.Fly
fly = fly:Clone()
fly.Parent = player.StarterGear
pcall(function()
player.Character.Humanoid.Health = 0
end)
end
end)
end)
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
03 Aug 2012 11:44 AM
Guys? You there?
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 11:51 AM
I meant edited, btw I can't see any errors in this script, can you tell the output you get?
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
03 Aug 2012 11:57 AM
Well, sure.

I cut and pasted it and there was no Output. Now I'm gonna have Output open when I hit the spawn that changes your team...

I can't. It's REALLY hard to win in my game, but it only takes like a minute and a half to get to winners IF everything goes right. Well, it's hard to make everything go right. So, there's no Output. Maybe you could make the script from scratch? I dunno.
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
03 Aug 2012 12:14 PM
Just because I'm talking to cheatmaster and technically miz, doesn't mean you guys can't help me too! Feel free to post and help me out!
Report Abuse
Dozer86421 is not online. Dozer86421
Joined: 18 Aug 2011
Total Posts: 726
03 Aug 2012 12:21 PM
-.- Anyone there? Miz? I know cheatmaster isn't here right now. He's AFK.
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 12:49 PM
function WaitForChild(parent,childName,className)
while wait() do
for i,v in ipairs(parent:GetChildren()) do
if (v.Name==childName and not className)
or
(not childName and v.ClassName==className)
or
( v.Name==childName and v.ClassName==className) then
return v
end
end
end
end

--Made by Dozer86421
game.Players.PlayerAdded:connect(function(player)
player.Changed:connect(function()
if player.TeamColor == BrickColor.new("Bright red") then
if WaitForChild(player,"StarterGear"):findFirstChild("Fly") then return end
local fly = game.Lighting.Fly
fly = fly:Clone()
fly.Parent = WaitForChild(player,"StarterGear")
pcall(function()
player.Character.Humanoid.Health = 0
end)
end
end)
end)
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 01:07 PM
I have been on your place and seen that you have added the script and it works perfect for me.
Report Abuse
flamingotrainer8 is not online. flamingotrainer8
Joined: 16 Mar 2010
Total Posts: 303
03 Aug 2012 01:12 PM
It is because in one of the lines where you say player.Starterpack or whatever I recommend make it this:

--Made by Dozer86421
game.Players.PlayerAdded:connect(function(player)
player.Changed:connect(function()
if player.TeamColor == BrickColor.new("Bright red") then
local fly = game.Lighting.Fly
fly = fly:Clone()
derp=player.Name
fly.Parent = game.Players.derp.StarterGear(or backpack or whaterver you want)
pcall(function()
player.Character.Humanoid.Health = 0
end)
end
end)
end)

~The Foruming Flamingo~
Report Abuse
flamingotrainer8 is not online. flamingotrainer8
Joined: 16 Mar 2010
Total Posts: 303
03 Aug 2012 01:14 PM
note that you can't just do player.backpack because it won't work, you need to specify the name and I did that by specifying the name and then giving its detailed location.

~The Foruming Flamingo~
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 01:45 PM
fixed creator script:

--Made by Dozer86421
game.Players.PlayerAdded:connect(function(player)
if player.Name == "Dozer86421" then
local fly = game.Lighting.Fly
fly = fly:Clone()
fly.Parent = player.StarterGear
player.Character.Humanoid.Health = 0
end
end)
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