This site is not for requests, but since I'm feeling nice I can give you a quick sample. Of course, this is just a basic script that you might want to add more checks or things to improve efficiency.
You would accomplish this by using the .Touched event. You can read more about that here:
I do know that this script can be flawed, but it should work.
local part=script.Parent
part.Touched:connect(function(hit)
end)
Now that we are inside the .Touched function:
if(game.Players:GetPlayerFromCharacter(hit.Parent) and hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("Humanoid").Health>0) then
local player=game.Players:GetPlayerFromCharacter(hit.Parent)
local leaderstats=player:WaitForChild("leaderstats", 5)
if(leaderstats) then
local money=leaderstats:FindFirstChild("Money")
if(money) then
money.Value=money.Value+50
end
end
end
part:Destroy()
Full script:
local part=script.Parent
part.Touched:connect(function(hit)
if(game.Players:GetPlayerFromCharacter(hit.Parent) and hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("Humanoid").Health>0) then
local player=game.Players:GetPlayerFromCharacter(hit.Parent)
local leaderstats=player:WaitForChild("leaderstats", 5)
if(leaderstats) then
local money=leaderstats:FindFirstChild("Money")
if(money) then
money.Value=money.Value+50
end
end
end
part:Destroy()
end)
4 comments
Btw my actual account is DarknessFriggus, I forgot what my old account for this was.
It appears your previous account name was bozley56. Try resetting your password for that account. If you can not get a password reset link due to an invalid email or other reason, contact support at https://scriptinghelpers.org/contact
@M39 Yeah it was from ages and ages ago.
script.Parent.Touched:connect(function(hit) if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then game.leaderstats.money.Value = game.leaderstats.money.Value + 10 end end )