I created (supposedly) a player launcher. It doesn't work though. What's the problem?
script.Parent.Touched:Connect(function(part) local parent = part.Parent local humanPart = parent:FindFirstChild("HumanoidRootPart") local plr = game.Players:FindFirstChild(parent.Name) if humanPart and plr then humanPart.Velocity = Vector3.new(0, 10000, 0) print(humanPart.Velocity) end end)
the script's Parent is a part named "launcher" in Workspace.
I don't think you have to change velocity. Instead, use BodyForce:
local alreadyhit = false -- setting a variable that will work as debounce script.Parent.Touched:Connect(function(part) if alreadyhit == false then -- checking if that variable is false, then alreadyhit = true -- making it true, so it doesnt repeats local char = part.Parent -- getting char local player = game.Players:GetPlayerFromCharacter(char) -- getting player if player and char:FindFirstChild("HumanoidRootPart") then -- if player exists then local bv = Instance.new("BodyVelocity") bv.Parent = char.LowerTorso bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) bv.P = 25000 bv.Velocity = char.HumanoidRootPart.CFrame.upVector * 100 -- this creates a bodyvelocity which maxforce is inf, the "P" is 25000, and that will make the player go up. How? It takes the humanoidrootpart upVector, like the y axis, and it multiplys that value by 100. game.Debris:AddItem(bv, 2) -- deletes the body velocity after 2 seconds alreadyhit = false -- set the variable to false so it can work again end end end)
This will throw the player up. I tell you this because I got problems changing velocity, so I recommend using Body Force. Hope I helped.