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
 

Re: Add item to player, when leaderstats reaches a certain value

Previous Thread :: Next Thread 
topogigio is not online. topogigio
Joined: 26 Aug 2008
Total Posts: 43
03 Nov 2017 07:40 PM
How would I make a script that would add a sword to the player when their points in leaderstats for example reaches 1000?


Report Abuse
DevVince is not online. DevVince
Joined: 08 Nov 2008
Total Posts: 9245
03 Nov 2017 07:43 PM
if value >= 1000 then


Report Abuse
jmiller184 is not online. jmiller184
Joined: 26 Jul 2013
Total Posts: 3333
03 Nov 2017 07:53 PM
if game.Players.LocalPlayer.leaderstats.(your points name).Value>=(your value) then
--put your stuff here
end
Report Abuse
topogigio is not online. topogigio
Joined: 26 Aug 2008
Total Posts: 43
03 Nov 2017 08:01 PM
I'm still grasping the basics, so I'm not sure how I would go about implementing that into a script. Could you help?


Report Abuse
topogigio is not online. topogigio
Joined: 26 Aug 2008
Total Posts: 43
03 Nov 2017 08:02 PM
########### Ignore my last reply
Report Abuse
topogigio is not online. topogigio
Joined: 26 Aug 2008
Total Posts: 43
03 Nov 2017 08:25 PM
For now, I'm trying to remove all tools from the player. However when I use this script, nothing happens:


if game.Players.LocalPlayer.leaderstats.Points.Value>=(20) then
game.Players.LocalPlayer.Backpack:CleanAllChildren()
end


Is this correct, or am I putting it in the wrong place?
(tried Workspace and StarterPlayerScripts)


Report Abuse
darkblooood is online. darkblooood
Joined: 20 Oct 2009
Total Posts: 57
03 Nov 2017 08:33 PM
im not that great at lua myself, but first are your using a local script?

if you are try:

if game.Players.LocalPlayer.leaderstats.Points.Value >= 1000 then
game.Players.LocalPlayer.Backpack:ClearAllChildren()
end



Report Abuse
topogigio is not online. topogigio
Joined: 26 Aug 2008
Total Posts: 43
04 Nov 2017 05:46 AM
Doesn't work. I get the following error:

"leaderstats is not a valid member of Player"


Report Abuse
topogigio is not online. topogigio
Joined: 26 Aug 2008
Total Posts: 43
04 Nov 2017 09:24 AM
.


Report Abuse
Chrounum is not online. Chrounum
Joined: 04 Apr 2015
Total Posts: 2911
04 Nov 2017 09:28 AM
have you made the leaderboard? the thing that holds the points has to be called "leaderstats" with a lowercase l


when the meme so supreme you let out a scream... ^o^
Report Abuse
topogigio is not online. topogigio
Joined: 26 Aug 2008
Total Posts: 43
04 Nov 2017 09:47 AM
Yes of course, I double checked.


Report Abuse
Chrounum is not online. Chrounum
Joined: 04 Apr 2015
Total Posts: 2911
04 Nov 2017 09:50 AM
is leaderstats in player?


when the meme so supreme you let out a scream... ^o^
Report Abuse
topogigio is not online. topogigio
Joined: 26 Aug 2008
Total Posts: 43
04 Nov 2017 10:40 AM
Yeah


Report Abuse
imepic457 is online. imepic457
Joined: 21 Dec 2012
Total Posts: 212
04 Nov 2017 10:47 AM
LocalPlayer:WaitForChild('leaderstats') mayyyyyyyyyyybe
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
04 Nov 2017 10:57 AM
You need an event listener for this

local sword = game.ServerStorage["Sword"]

game.Players.PlayerAdded:Connect(function(player)

repeat wait() until player:FindFirstChild("leaderstats")

player.leaderstats.Points.Changed:Connect(function()
if player.leaderstats.Points.Value >= 1000 and (not player.Backpack:FindFirstChild(sword.Name)) then
sword:Clone().Parent = player.Backpack
end
end)

end)

You'll have to edit this, of course, to work with the specific gear you are using.
Report Abuse
topogigio is not online. topogigio
Joined: 26 Aug 2008
Total Posts: 43
04 Nov 2017 01:00 PM
Uh, every time I paste this script ROBLOX Studio crashes. What the hell is going on?


Report Abuse
topogigio is not online. topogigio
Joined: 26 Aug 2008
Total Posts: 43
05 Nov 2017 12:23 PM
It seems that every time I finish writing ("leaderstats") at the end of the line:

repeat wait() until player:FindFirstChild("leaderstats")


My ROBLOX Studio crashes. This is weird.


Report Abuse
popu2004 is not online. popu2004
Joined: 16 Feb 2013
Total Posts: 176
05 Nov 2017 12:55 PM
Mister_Manakin i tried that script for some reason and it makes me get alot of the gear like. If i get 10 i get the sword then i get # ####### more and i get 1 sword more...
Report Abuse
popu2004 is not online. popu2004
Joined: 16 Feb 2013
Total Posts: 176
05 Nov 2017 12:57 PM
then when i get on e power more than te n "points" i get on e sword more


Report Abuse
popu2004 is not online. popu2004
Joined: 16 Feb 2013
Total Posts: 176
05 Nov 2017 12:58 PM
point*

not power.


Report Abuse
popu2004 is not online. popu2004
Joined: 16 Feb 2013
Total Posts: 176
05 Nov 2017 01:29 PM
nvm fixed it.


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