Actually you don’t need math.abs Since Magnitude represents the length of the Vector it cannot be negative.
Magnitude is basically distance or length. Thats how I like to think of it.
Actually you don’t need math.abs Since Magnitude represents the length of the Vector it cannot be negative.
Magnitude is basically distance or length. Thats how I like to think of it.
game.ReplicatedStorage.remote:FireServer(touchedPart)
oh… i see, thanks a ton ill change that now
all that does is destroy the part and kill the player
if i kill the player in a local script, does that kill the player for everyone or just the player
like do i have to kill them on the server
It should kill the player and since the player character replicates to the server, everyone should see the player dies.
So killing the player in LocalScript should work.
alright got it
also my previous question, if the problem is the touched detecting the 0 when it stops when it hits the player, how do i fix that?
Probably setting CanCollide
to false.
One last thing to note Im not sure Humanoid has a Touched event. You may want to use the HumanoidRootPart
it does im not only fairly certain of it but it worked earlier
like the code was still broken but broken to the point where it killed the player when it touched them
You might want to switch the .Touched
to the projectile/part.
well it just fell straight through the world and through the player
Yeah of course it will, if it doesn’t have any velocity from BodyMovers or anything like that, it will just fall down.
wait
wait you cant have a variable for a property can you
What exactly do you mean? {30_chars}
i mean im saying it fell through the world without killing the player so i assume thats not our issue
i have a variable (vel) for the assemblylinearvelocity of our part, and you cant have a variable for a property right…?
i changed it and it didnt do anything tho so
You can initialize variable with anything. What did you exactly change?
i just removed the variable “vel” and replaced it with just part.AssemblyLinearVelocity and all that
also new development…? i just rewrote the code to be like this
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
character:WaitForChild("Humanoid").Touched:Connect(function(touchedPart, bodyPart)
game.Players.LocalPlayer.Character.Humanoid.Health = 0
end)
and it killed the player everytime they spawned (as it should) so it must be an issue with the if statement…
i gtg briefly
Wait so if I understand this right. You want to kill the player only when the part has Velocity bigger than 50? If yes, could you tell me how are you testing the part flying into the player?
Alright, I tested it in my own studio and everything works for me. You might be testing it wrong. I tested that when the part is Collidable it will decrease the velocity when hit and .Touched will detect the decreased one which will be most of the time under 50.
LocalScript inside StarterCharacter:
local char = script.Parent
char.Humanoid.Touched:connect(function(part)
local mag = part.AssemblyLinearVelocity.Magnitude
if(mag>50) then
char.Humanoid.Health = 0
end
end)