-- Script to apply force to players who touch the part
local part = script.Parent -- The part this script is attached to
-- Function to apply force when a player touches the part
local function onTouch(other)
-- Check if the object that touched the part is a player character
local character = other.Parent
if character and character:FindFirstChild("Humanoid") then
-- Get the HumanoidRootPart of the character
local rootPart = character:FindFirstChild("HumanoidRootPart")
if rootPart then
-- Apply a force to the HumanoidRootPart
local bodyVelocity = Instance.new("BodyVelocity")
bodyVelocity.Velocity = Vector3.new(0, 100, 0) -- Change the velocity vector to control the force
bodyVelocity.Parent = rootPart
-- Optionally, remove the BodyVelocity after a short time
game:GetService("Debris"):AddItem(bodyVelocity, 0.5)
end
end
end
-- Connect the onTouch function to the Touched event of the part
part.Touched:Connect(onTouch)
To embed this project on your website, copy the following code and paste it into your website's HTML: