Sorry For Bad English, I Am Making Script That When You Triggered Prompt, You Will Get Billboard Gui With "Wanted" Text On Head, And Need To Hide Until 100 Seconds Pass To Get Money, And If You Dies, You Drop The Money That You Got From Robbery, And Other Player Can Claim It But Problem Is That I Can Claim It too, And I Want Only Other Player Can Claim It, Can Someone Advice Me?, I'm Begginer To Scripting!
Cash Script
local money = script.Parent.Parent
local clickDetector = money.ClickDetector
clickDetector.MouseClick:Connect(function(plr)
local cash = plr.leaderstats.Gold
local amountValue = money.BillboardGui.amountOfCash
cash.Value += amountValue.Value
money:Destroy()
end)
Proximity Prompt Script
local db = true
local script1 = game.Lighting.RobberyCashDrop.CashDrop
local gui = game.Lighting.RobberyCashDrop.WantedGUI
script.Parent.Triggered:Connect(function(plr)
local Character = plr.Character or plr.CharacterAdded:Wait()
if db == true then
db = false
local a = script1:Clone()
a.Parent = Character
local b = gui:Clone()
b.Parent = Character:FindFirstChild("Head")
wait(100)
plr.leaderstats.Gold.Value = plr.leaderstats.Gold.Value + 250
a:Destroy()
b:Destroy()
db = true
else
if plr.PlayerGui:FindFirstChild("NoMoneyPrompt") then
plr.PlayerGui:FindFirstChild("NoMoneyPrompt"):Destroy()
local errorprompt = game.ReplicatedStorage.RobberyGUI.NoMoneyPrompt:Clone()
errorprompt.Parent = plr.PlayerGui
wait(1)
errorprompt:Destroy()
else
local errorprompt = game.ReplicatedStorage.RobberyGUI.NoMoneyPrompt:Clone()
errorprompt.Parent = plr.PlayerGui
wait(1)
errorprompt:Destroy()
end
end
end)
Cash Drop Script
local char = script.Parent
local human = char:WaitForChild("Humanoid")
local humanRoot = char:WaitForChild("HumanoidRootPart")
local cash = game.Lighting.RobberyCashDrop:WaitForChild("Cash")
local PlayerService = game:GetService("Players")
human.Died:Connect(function()
local playerFromCharacter = PlayerService:GetPlayerFromCharacter(human.Parent)
local moneyDropped = 250
local cashClone = cash:Clone()
cashClone.BillboardGui.amountOfCash.Value = moneyDropped
cashClone.BillboardGui.amount.Text = "$" .. tostring(moneyDropped)
cashClone.Parent = game.Workspace
cashClone.CFrame = humanRoot.CFrame + (humanRoot.CFrame.LookVector * Vector3.new(2,2,2))
end)

1 comment
Name the IntValue too in case if there are two or more children named "IntValue" in cashClone