Congratulations on being able to do it on your own! That’s the kind of effort I like seeing result from this category and wish I saw more of.
I realise a bit late that your character would probably be suspended in the air in the Freefalling state if you were to do this, meaning that natural jumping would not work for dismounting a player off a zipline. This would require a bit more work to get done.
For this, I would probably create a separate handler that will force the character to jump if they’re on a zipline (and only if), just so that it’s easier to handle the dismounting. You will need to have a way to identify if players are ziplining - for example, the weld you create can simply be renamed to “ZiplineWeld”.
A RemoteEvent will be needed. A LocalScript will track client input for a jump while the server follows through in forcing the player to jump if the conditions are met. For this, you will need JumpRequest. For some odd reason it fires multiple times per request to jump, so you’ll also need to make sure it can only fire every so often.
A LocalScript in StarterPlayerScripts, maybe called ZiplineJumpHandler, will be responsible for asking the server to perform a forced jump. It will fire a RemoteEvent in ReplicatedStorage called RequestZiplineDismount. I think you can do it from the client itself, but just to be sure we’ll have the server make us jump.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local Player = Players.LocalPlayer
local RequestDismountZipline = ReplicatedStorage.RequestDismountZipline
local COOLDOWN = 0.5
local lastSendTime = 0
local function jumpRequested()
local currentTime = os.clock()
if currentTime - lastSendTime >= COOLDOWN then
lastSendTime = currentTime
local character = Player.Character
if character and character:FindFirstChild("Head") and character.Head:FindFirstChild("ZiplineWeld") then
RequestDismountZipline:FireServer()
end
end
end
UserInputService.JumpRequest:Connect(jumpRequest)
The server can then return in kind. A script in ServerScriptService, ZiplineDismountHandler or something.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RequestDismountZipline = ReplicatedStorage.RequestDismountZipline
local function onServerEvent(player)
local character = player.Character
local humanoid = character and character:FindFirstChild("Humanoid")
if character and humanoid then
if character:FindFirstChild("Head") and character.Head:FindFirstChild("ZiplineWeld") then
humanoid:ChangeState(Enum.HumanoidStateTyle.Jumping)
end
end
end
RequestDismountZipline.OnServerEvent:Connect(onServerEvent)
This might work, feel free to give it a shot.