How To Make Dropped Cash Only Can Claimed By Other Player?
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
01 | local money = script.Parent.Parent |
02 | local clickDetector = money.ClickDetector |
04 | clickDetector.MouseClick:Connect( function (plr) |
06 | local cash = plr.leaderstats.Gold |
07 | local amountValue = money.BillboardGui.amountOfCash |
08 | cash.Value + = amountValue.Value |
Proximity Prompt Script
02 | local script 1 = game.Lighting.RobberyCashDrop.CashDrop |
03 | local gui = game.Lighting.RobberyCashDrop.WantedGUI |
05 | script.Parent.Triggered:Connect( function (plr) |
06 | local Character = plr.Character or plr.CharacterAdded:Wait() |
09 | local a = script 1 :Clone() |
12 | b.Parent = Character:FindFirstChild( "Head" ) |
14 | plr.leaderstats.Gold.Value = plr.leaderstats.Gold.Value + 250 |
19 | if plr.PlayerGui:FindFirstChild( "NoMoneyPrompt" ) then |
20 | plr.PlayerGui:FindFirstChild( "NoMoneyPrompt" ):Destroy() |
21 | local errorprompt = game.ReplicatedStorage.RobberyGUI.NoMoneyPrompt:Clone() |
22 | errorprompt.Parent = plr.PlayerGui |
26 | local errorprompt = game.ReplicatedStorage.RobberyGUI.NoMoneyPrompt:Clone() |
27 | errorprompt.Parent = plr.PlayerGui |
Cash Drop Script
01 | local char = script.Parent |
02 | local human = char:WaitForChild( "Humanoid" ) |
03 | local humanRoot = char:WaitForChild( "HumanoidRootPart" ) |
04 | local cash = game.Lighting.RobberyCashDrop:WaitForChild( "Cash" ) |
05 | local PlayerService = game:GetService( "Players" ) |
07 | human.Died:Connect( function () |
08 | local playerFromCharacter = PlayerService:GetPlayerFromCharacter(human.Parent) |
09 | local moneyDropped = 250 |
10 | local cashClone = cash:Clone() |
11 | cashClone.BillboardGui.amountOfCash.Value = moneyDropped |
12 | cashClone.BillboardGui.amount.Text = "$" .. tostring (moneyDropped) |
14 | cashClone.Parent = game.Workspace |
16 | cashClone.CFrame = humanRoot.CFrame + (humanRoot.CFrame.LookVector * Vector 3. new( 2 , 2 , 2 )) |