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
 

Help

Previous Thread :: Next Thread 
TheMinecraftRules is not online. TheMinecraftRules
Joined: 15 Aug 2013
Total Posts: 878
23 Dec 2014 11:05 AM
script.Parent.Touched:connect(function(player)
if player:FindFirstChild("leaderstats") then
if player.leaderstats.Money.Value>4 then
player.leaderstats.Money.Value=player.leaderstats.Money.Value-5
end
end
end)

This script does not work(and yes I did make the leaderstats)
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Dec 2014 11:07 AM
Look at the parameters for the "Touched" event of BasePart.
Report Abuse
TheMinecraftRules is not online. TheMinecraftRules
Joined: 15 Aug 2013
Total Posts: 878
24 Dec 2014 02:37 AM
Bump
Report Abuse
Qivr is not online. Qivr
Joined: 22 Aug 2014
Total Posts: 5407
24 Dec 2014 02:40 AM
script.Parent.Touched:connect(function(hit)
local playerfromhit = hit.Parent:findFirstChild("Humanoid").Parent
local player = game.Players:findFirstChild(playerfromhit.Name)
if player:FindFirstChild("leaderstats") then
if player.leaderstats.Money.Value>=4 then
player.leaderstats.Money.Value=player.leaderstats.Money.Value-5
end
end
end)--should work

[Qivr] Hail Greenland!
Report Abuse
DavidBene is not online. DavidBene
Joined: 26 Nov 2014
Total Posts: 163
24 Dec 2014 02:41 AM
What was your output? Did you get an error?
Report Abuse
Qivr is not online. Qivr
Joined: 22 Aug 2014
Total Posts: 5407
24 Dec 2014 02:43 AM
Just so you can understand,
the (hit) part in (function(hit) is the body part that hits the part
and i'm assuming leaderstats are in the player in the list game.Players
and the (hit) comes from the player in workspace, so your script was trying to find the leaderstats in your in-game character.
also in an if statement, you can't just have a "Value>4" you have to have "==" or ">=" or "<="
hopefully you understand im bad at explaining things qqq

[Qivr] Hail Greenland!
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