I’m struggling to create a block, currently a ball/sphere which will bounce players who are walking or jump onto the block.
My script is;
while true do script.Parent.Velocity = script.Parent.CFrame.lookVector *200 wait(0) end
I’m struggling to create a block, currently a ball/sphere which will bounce players who are walking or jump onto the block.
My script is;
while true do script.Parent.Velocity = script.Parent.CFrame.lookVector *200 wait(0) end
Make a touched event, and check if it’s a player. If so, set their jump power to something high for a sec, force them to jump, and reset their jump power.
How do I make a touched event? (Sorry, beginner scripter here).
That’s ok, everyone’s a beginner at one point.
A touched event is:
(part).Touched:Connect(function(player)
end)
The player is the player, the part is the bouncy part, and the rest is somewhat self-explanatory.
Thanks, I’ll look up some scripting wiki pages and see what I can do.
This should work (place in a script inside the bouncy ball/part)
local touch = script.Parent
local force = 40 --how high
touch.Touched:Connect(function(plr)
if plr then
if plr.Parent:FindFirstChild("HumanoidRootPart") then
local root = plr.Parent.HumanoidRootPart
if root:FindFirstChild("JumpForce") == nil then
local jump = Instance.new("BodyForce")
jump.Force = Vector3.new(0,math.pow(force,2),0)
jump.Parent = root
plr.Parent.Humanoid.Jump = true
wait(0.1)
if jump and plr then
jump:Destroy()
end
end
end
end
end)