I’m trying to make a mechanic where a player would touch a launchpad and be launched upwards. The LaunchPad part is in game.Workspace and has a NumberValue called “Speed” that is a value of 20. The part flashes when I touch it, but does not send the player upward. There is also nothing in the output. How would I fix this?
local TS = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local char = player.Character
local hum = char:WaitForChild("Humanoid")
local rootpart = char:WaitForChild("HumanoidRootPart")
local LaunchPad = game.Workspace.LaunchPad
local LaunchPower = LaunchPad.Speed
local LaunchDebounce = false
LaunchPad.Touched:Connect(function(touched)
if touched.Parent:FindFirstChild("Humanoid") and LaunchDebounce == false then
LaunchDebounce = true
LaunchPad.Color = Color3.fromRGB(255, 255, 255)
rootpart:ApplyImpulse(Vector3.new(0, LaunchPower, 0))
task.wait(0.1)
local LaunchTween = TS:Create(LaunchPad, TweenInfo.new(0.6), {Color = Color3.fromRGB(58, 158, 93)})
LaunchTween:Play()
LaunchTween.Completed:Connect(function()
LaunchDebounce = false
end)
end
end)