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
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| Joined: 26 Aug 2008 |
| Total Posts: 43 |
|
|
| 03 Nov 2017 08:02 PM |
| ########### Ignore my last reply |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 26 Aug 2008 |
| Total Posts: 43 |
|
| |
|
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
|
  |
| Joined: 26 Aug 2008 |
| Total Posts: 43 |
|
|
| 04 Nov 2017 09:47 AM |
Yes of course, I double checked.
|
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 26 Aug 2008 |
| Total Posts: 43 |
|
| |
|
imepic457
|
  |
| Joined: 21 Dec 2012 |
| Total Posts: 212 |
|
|
| 04 Nov 2017 10:47 AM |
| LocalPlayer:WaitForChild('leaderstats') mayyyyyyyyyyybe |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 16 Feb 2013 |
| Total Posts: 176 |
|
| |
|
popu2004
|
  |
| Joined: 16 Feb 2013 |
| Total Posts: 176 |
|
| |
|