It's pretty simple, except, i dont know how to do it.
I just need a script that gives the player a tool on spawn if they have 50 Gold.
Thank you for Helping!
It's pretty simple, except, i dont know how to do it.
I just need a script that gives the player a tool on spawn if they have 50 Gold.
Thank you for Helping!
Hopefully, this answers your question if it did please accept my answer.
This script will check each time a player's gold is updated and if the value is over or equal to 50 gold it will give it the tool.
The tool part you have to do yourself because I do not know what the tool's name is.
I've tested the script and it should work perfectly only you have to remember to change the tool's name in line 13
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
Players.PlayerAdded:Connect(function(player)
while true do
wait(.5)
local PlayerGold = player.leaderstats.Gold
if PlayerGold.Value >= 50 then -- When a player gets 50 or more gold he gets the tool
local ToolCopy = ReplicatedStorage.Tool:Clone() -- Change where it says ("Tool") to your tool's name
ToolCopy.Parent = player.Backpack
script:Destroy()
break
end
end
end)
This Looped it. Do you think you can make one that doesn't loop?
It gave me so many that the inventory ScrollingFrame ran out of space
Hahaha forgot about that one I will just edit my aswer :D
Fixed it so when the if thing works the loop will break and not give you anything more
Where would this script go?
The script wold most likely go into ServerScriptService
So I decided to re-write johnoscarbhv1's script into something that won't continuously duplicate the tool. I didn't test it but I hope it works for you:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
Players.PlayerAdded:Connect(function(player)
local PlayerGold = player.leaderstats.Gold
repeat wait(0.5) until PlayerGold.Value == 50 or PlayerGold.Value > 50
local ToolCopy = ReplicatedStorage.Tool:Clone() -- Change where it says ("Tool") to your tool's name
ToolCopy.Parent = player.Backpack
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
This is not a request website. Please review the community guidelines before posting a question.