Money for destroying parts with a bomb?

Hello! I am trying to make a system similar to Destruction Simulator’s reward system for destroying parts with your tool ( getting points for each part you destroyed. I was trying to add it onto the default bomb Roblox has but I could not get the point rewarding working ( I couldn’t get the player’s leaderstats. If you could help I would appreciate it.

Don’t ask for full scripts, that’s not allowed.

I’m not asking for full scripts?

Where is the script in here?

You are supposed to show the script and then people can help you, not Full-Scripts.

Well, I was gonna give the script to people who were willing to help. Never was asking for full scripts lol

Well then show the script so people can help.

I will? Just don’t assume I am wanting full scripts when I specifically said “If you could help I would appreciate it.”

just send the script i can help you if i can

> 
> function blowUp()
>     local sound = Instance.new("Sound")
>         sound.SoundId = "rbxasset://sounds\\Rocket shot.wav"
>         sound.Parent = script.Parent
>         sound.Volume = 1
>         sound:play()
>     explosion = Instance.new("Explosion")
>     explosion.BlastRadius = 12
>     explosion.BlastPressure = 1000000 -- these are really wussy units
> 
>     -- find instigator tag
>     local creator = script.Parent:findFirstChild("creator")
>     if creator ~= nil then
>         explosion.Hit:connect(function(part, distance)  onPlayerBlownUp(part, distance, creator) end)
>     end
>     explosion.Hit:Connect(function(bricks)
>         local brickParts = 0
>         brickParts += 1
>         -- (Just not sure how to get the players leaderstats and reward the player, again I tried RemoteEvents and nothing will work.)
>     end)

does it show any errors? if so send the error too

There is no errors I am just having troubles getting the players leaderstats. As you can see in the script I added
(Just not sure how to get the players leaderstats and reward the player, again I tried RemoteEvents and nothing will work.)

Deleted, sorry.

He said it is not lua so sorry.

Thanks.

1 Like

ok so i found the error, it is very very simple. So firat make a remote function in replicated storage. And then create a part in the workspace. Now if u have any tools, add a script to it. Script. Now make it when the player clicks it, it should invoke the remote function. After that just make the part go where the curser is clicked to know how to do that, it is in the devhub/ I hope this helps.

Do you understand what I want though? Again, I want a system similar to Destruction Simulator’s reward system for destroying parts with your tool(bomb, etc).

I love how you tried helping someone even while not being a scripter

absolute mad legend. You have earned my respect despite having code that is sure to error.

2 Likes
game.Players.PlayerAdded:Connect(function(player)
stats = Instance.new("Folder",player)
sats.Name = "leaderstats"
--just add the a number value and copy the above code
end)

so just take the part or mesh and then just put in the position of the player(sorry im noob at scripting) i hope this helps

That’s not how program in Lua is written, that looks like a mess akin to “techno-babble” - you should garner more experience before contributing code.

@Wythos if it’s just for parts, you could get what the Explosion hit (via Explosion.Hit) and checking if it was a BasePart. If it was, then give the player X points based upon Y amount of parts hit.

I am using that, I am just having trouble getting the players leaderstats.

Assuming a server Script is being used within a tool, you could use a method I use to get the player holding the tool-

local player = nil

...

tool.Equipped:Connect(function()
    while not player do
        player = game.Players:GetPlayerFromCharacter(tool.Parent)
        wait()
    end
end)

It’s a very simple way to get the player, but from my experience its been fairly reliable.
From there, when you run the code for the explosion, you could add to the money stat. player.Money.Value += 5