✓ Accepted answer
Alright man. If you've ever seen a killbrick you should be able to use Itzlewis' answer to solve your problem. But I'll give you how to get the player from the server side.
function onTouch(hit)
local hum = hit.Parent.Humanoid
if hum then
local c = hum.Parent
local BV = Instance.new("BodyVelocity", PARTYOUWANT)
BV.maxForce = Vector3.new(25000,25000,25000)
BV.Velocity = c.HumanoidRootPart.CFrame.lookVector*40
game.Debris:AddItem(BV,0.5)
BV.Velocity = BV.Velocity + Vector3.new(0,15,0)
end
end
script.parent.Touched:connect(onTouch)
And yeah that's it. You should be able to get the player from the server side because touched gives the touching part automatically as the first parameter. If you don't know what i mean by that, i highly recommend you look at this: https://developer.roblox.com/en-us/api-reference/event/BasePart/Touched
Thank you. Any problems you can reach out to me via discord (BlobMaster#8156) or you can message me on roblox. pls only message me if you have a problem relating to this question, though the code i gave you should fill your needs. Till next time.
3 comments
yeah but like how do i make it server side?
you make it a script
Well but itzlewiz in server scripts you cant do game.Players.LocalPlayer