Player does not teleport to the round when on zipline

Ok! I would be glad to show the script:

Zipline

local tweenService = game:GetService("TweenService")
local startZip = script.Parent.Start
local endZip = script.Parent.End
local move = script.Parent.Zipline.Move
local handle = script.Parent.Zipline.BodyAttach
local primary = script.Parent.Zipline.PrimaryPart
local proximityPrompt = move.ProximityPrompt


local function moveItem(item, wp)
	local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Linear,
		Enum.EasingDirection.Out, 0, false, 0)
	local tween = tweenService:Create(item, tweenInfo,
		{Position = wp.Position})
	tween:Play()
	wait(3)
end

wait(5)

proximityPrompt.Triggered:Connect(function(player)
	proximityPrompt.Enabled = false
	local motor = Instance.new("Motor6D")
	motor.Part0 = player.Character.UpperTorso
	motor.Part1 = handle
	motor.Parent = player.Character.UpperTorso
	
	local anim = Instance.new("Animation")
	anim.AnimationId = "rbxassetid://6881429256"
	anim.Parent = script
	
	local animTrack = player.Character.Humanoid:LoadAnimation(anim)
	animTrack:Play()
	moveItem(primary, endZip)
	motor:Destroy()
	animTrack:Stop()
	wait(5)
	primary.Position = startZip.Position
	wait()
	anim:Destroy()
	proximityPrompt.Enabled = true
end)

But how would I be able to find out the round is starting??? What would I have to do with that.

1 Like

Are you firing any sort of event when the round has started? If not you could and then anyone on the zip line when the event is fired would be ejected then teleported.

1 Like

A remote event correct? Would you able to show an example???

1 Like

Well I was thinking more of a bindable event for when your round is starting. I’m assuming your round handler is using a server sided script? You can use a for loop to find any players who are on the zip line and eject them, maybe try making them jump? If you don’t want to do it in your handler script you could try making a bindable event and making a separate script.

For example:
When someone gets on the zip line you add a value to their player, or character, letting us know they’re currently in the zip line and the value would get removed when they exit the zip line. Then when your round starts use a for loop to find all the players who might be on a zip line by checking for the value assigned to them. Then just eject all the players who are on the zip line, maybe by making their characters jump.

Could you share your round handler/teleportation script?

1 Like

I think this is what you are looking for:

Zipline script

local tweenService = game:GetService("TweenService")
local startZip = script.Parent.Start
local endZip = script.Parent.End
local move = script.Parent.Zipline.Move
local handle = script.Parent.Zipline.BodyAttach
local primary = script.Parent.Zipline.PrimaryPart
local proximityPrompt = move.ProximityPrompt

wait(1)

proximityPrompt.Triggered:Connect(function(player)
	proximityPrompt.Enabled = false
	local motor = Instance.new("Motor6D")
	motor.Part0 = player.Character.UpperTorso
	motor.Part1 = handle
	motor.Parent = player.Character.UpperTorso
	
	local anim = Instance.new("Animation")
	anim.AnimationId = "rbxassetid://6881429256"
	anim.Parent = script
	
	local animTrack = player.Character.Humanoid:LoadAnimation(anim)
	animTrack:Play()
	local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Linear,
    Enum.EasingDirection.Out, 0, false, 0)
	local tween = tweenService:Create(item, tweenInfo,
		{Position = wp.Position})
	tween:Play()
	motor:Destroy()
	animTrack:Stop()
    for i = 0, 50, 1 do
        if workspace.roundInProgress.Value == true then
            i = 50
        end
        wait(0.1)
    end
	primary.Position = startZip.Position
	wait()
	anim:Destroy()
    tween:Cancel()
	proximityPrompt.Enabled = true
end)

And then add this to your server script that handles the rounds

put this in the script where the round starts:

workspace.roundInProgress.Value = true

and put this in the script where the round ends:

workspace.roundInProgress.Value = false

And you should be good to go! Maybe teleport the player to the round like a second after changing roundInProgress to true, just to be safe :slight_smile:

Important: add a boolValue called roundInProgress under workspace

1 Like

Um, I think it didn’t exactly solve it. Would you like to see the main game script??? It’s really long so I should share it with you with Pastebin.

1 Like

you can just show the parts that handle the rounds. :grin:

1 Like

If you want to take a glance here:
https://pastebin.com/YhcfytAm

1 Like

Oh whoops. Ok but it’s connected with a module if that’s ok.

I mean the Pastebin is basically it.

1 Like

Ok I think my other reply solved it pretty much.
It is kind of hard to tell what is going on because it looks like you are using a module, but I can try and direct you towards where to put the lines of code I showed above.

The round starts after this line:

gameModule.Countdown(30, 0, -1, status, "A new round is starting in: ")

so that is about where you should set roundInProgress to true.
I can’t tell if you have finished the whole round system and when it should end, but I think you should set roundInProgress to false about where it where it says

gameModule.CheckWinner(status)

I hope this helps!

1 Like

what do you mean workspace.roundInProgress.Value = true Ok wait Im confused…

Edit:
Ok so do I just make a value and just do it like that???

1 Like

yup pretty much. Put a boolValue in workspace, name it roundInProgress, and insert that line in!

Could I put it in Replicated storage???

And what do you mean by that. Why a for i loop??

sure you could put it in replicated storage, but make sure to update the parent when referencing it.

The for loop is a kind of advanced… but I’ll try and explain as simply as I can. If the round doesn’t start while you are on the zipline, it waits 5 total seconds and then ejects the player normally. If the round does start while you are on the zipline, it ends early.

edit: I changed the script from the previous reply a bit bc something was wrong but I fixed it.

It didn’t exactly work for me.

What are you still having problems with? Did you make sure to change

workspace.roundInProgress.Value
to
game.ReplicatedStorage.roundInProgress.Value?

Yes I did all of that it just breaks my zipline.

Ohhhh
Just get player’s character and check if it’s not nil.
Then find humanoid.
Take this should help.
And for player teleporting issues i would use Run service to make him teleport to zipline ,and i would tween properties of zipline.

I figured it myself no worries! I just had to use the _G and a variable for the 2 scripts that are either true or false. Thanks for your help tho. Really appreciate this community.