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: Whats wrong with this

Previous Thread :: Next Thread 
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:15 PM
function onClicked(GUI)
a = script.Parent.Parent.Parent.Parent.Parent
b = a:FindFirstChild("leaderstats")
if b ~= nil then
c = b:FindFirstChild("KOs")
if c.Value >= 30 then
c.Value = c.Value - 30
local hu = player.Character:findFirstChild("Humanoid")
local t = player.Character:findFirstChild("Torso")
local h = player.Character:findFirstChild("Head")
local la = player.Character:findFirstChild("Left arm")
local ra = player.Character:findFirstChild("Right arm")
local ll = player.Character:findFirstChild("Left leg")
local rl = player.Character:findFirstChild("Right leg")
t.BrickColor = BrickColor.new("Medium stone grey")
h.BrickColor = BrickColor.new("Dark stone grey")
la.BrickColor = BrickColor.new("Medium stone grey")
ra.BrickColor = BrickColor.new("Medium stone grey")
ll.BrickColor = BrickColor.new("Medium stone grey")
rl.BrickColor = BrickColor.new("Medium stone grey")
hu.WalkSpeed = 35
if c.Value < 30 then
script.Parent.Text = "You dont have enough credits"
wait(3)
script.Parent.Text = "I want the silver suit"
end
end
end
end

script.Parent.MouseButton1Click:connect(onClicked)
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:17 PM
pls
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:18 PM
confusion
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:19 PM
...
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:19 PM
um
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:20 PM
i thought this was scripting helpers
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:20 PM
was i wrong
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:21 PM
probably
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:22 PM
ok
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:23 PM
so ya what
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:24 PM
forevr alon
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:24 PM
ogm
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
29 Nov 2013 06:25 PM
You used another if statement rather than elseif, try this.

--Put in a local script

local a = game.Players.LocalPlayer
local c = a.Character
local hu = c.Humanoid
local b = a:FindFirstChild("leaderstats")

function onClicked(GUI)
if b then
c = b:FindFirstChild("KOs")
if c.Value >= 30 then
c.Value = c.Value - 30
for i,v in pairs(a.Character:GetChildren()) do
if v:IsA("Part") then
if v.Name ~= "Head" then
v.BrickColor = BrickColor.new("Medium stone grey")
else
v.BrickColor = BrickColor.new("Dark stone grey")
end
end
end
hu.WalkSpeed = 35
elseif c.Value < 30 then
script.Parent.Text = "You dont have enough credits"
wait(3)
script.Parent.Text = "I want the silver suit"
end
end
end


script.Parent.MouseButton1Click:connect(onClicked)
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:25 PM
qq
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
29 Nov 2013 06:25 PM
output,
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:25 PM
othx C:
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:31 PM
@azarth
didnt work
@whatsurface
output says nothing
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
29 Nov 2013 06:33 PM
add a print("leaderstats are there") after if b then

If you're testing in solo, then playerAdded isn't going to work, therefore leaderstats aren't going in your player.
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
29 Nov 2013 06:41 PM
ah ok i am testing in solo
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