How to make killer queen coin throw and detonate

how to make when you press y you throw a coin infront of u and then u press h the coin explode deal damage to player around the coin

2 Likes

Have a few variables:

CoinThrown = false
CanThrow = true
ExplosionRadius = 16

detect when the player presses Y and check if CanThrow is true also check if CoinThrown is false, when he does that make a new coin, add a body velocity for about .2 seconds with the velocity being the lookvector of the player * a Amount. Set CoinThrown to true and CanThrow to false

Now check when the player presses H and now check if CoinThrown is true, Create a new explosion, parent to coin, and position to the coin. Set the ExplosionRadius to our ExplosionRadius Variable. then run a For i,v loop to find all the players in the workspace. Then make them take the amount of damage compared to their distance. You can do this by subtracting the 2 Positions.Magnitude. Set CoinThrown to false and CanThrow to true.

Sorry for this wall of text I don’t usually do this.

1 Like

how to add Magnitude show a example

and too remove the velocity use coin.Velocity:Destroy() ?

Magnitude is all the Vectors average combined, like this

player.Torso.Position.Magnitude

or

Vector3.new(5,5,5).Magnitude

you could use

game:GetService("Debris"):AddItem(Velocity, .2)

this would automatically delete it after .2 seconds

if i dont want automatically , did Velocity:Destroy() work?

Velocity:Destroy() would work yes.

5,5,5 mean how big the hitbox is?

5 studs, because the average is 5.

attempt to call a table value

local Stand = char:FindFirstChild(“Stand”)

coin.CFrame = Stand.RightHand.CFrame * CFrame(0,0,0)

on the last line you don’t need the

*CFrame(0,0,0)

and even if you wanted to add a CFrame it would have to be written like this

CFrame.new(0,0,0)

CFrame is not a valid member of Animation “Coin”

coin.CFrame = Stand.RightLowerArm.CFrame CFrame.new(0,0,0)

is there another Object called Coin? And is it a Animation?

also I should have mentioned between CFrame and CFrame.new there should be a multiply symbol. Like this

coin.CFrame = Stand.RightLowerArm.CFrame * CFrame.new(0,0,0)

the coin is a meshpart , nope there are not another Object called coin and its not a animation.

Try renaming your coin to something else

image
the coin appear behind me

are you applying the Velocity on it already?

coin.Velocity = Stand.RightHand.CFrame.lookVector * 40

https://gyazo.com/3fa7e4de8acb448aa254f59e9f0f7b08