Heyo Devforum! Recently, I have made two models one being a zipline and one being a balloon. I made both of these models inside a test game where I make and script my models. After I finished making the models, I imported them into the main game, and made some finishing touches to them. Both of these models involve touched events and welds, but the issue is that when something is touched from the model, the player is teleported to the same spot. For the zipline, the player is teleported somewhere into the lobby. For the balloon, the player is teleported outside of a tower I made with a friend. I am not sure if this is an issue with how I imported the models, or the scripts. Here are my scripts…
Zipline Script:
repeat wait() until game.Workspace:WaitForChild("Tower of Troubling Tutorials")
local ziplines = game.Workspace:WaitForChild("Tower of Troubling Tutorials").Ziplines:GetChildren()
local tweenservice = game:GetService("TweenService")
local runservice = game:GetService("RunService")
local player = game.Players.LocalPlayer
local playermodule = require(player:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule"))
local controls = playermodule:GetControls()
for i, zipline in pairs(ziplines) do
local isonzip = false
local line = zipline.Line
local linestart = zipline.LineStart
local finish = zipline.End
local start = zipline.Start
local speed = zipline.Speed
local slider = script.Slider
local animation = script.ZiplineHold
start.Touched:Connect(function(hit)
if not isonzip and player.Character and hit:IsDescendantOf(player.Character) then
isonzip = true
local character = player.Character
local humanoid = character.Humanoid
local sliderclone = slider:Clone()
sliderclone.Parent = game.Workspace:WaitForChild("Tower of Troubling Tutorials").Ziplines
sliderclone.PrimaryPart.CFrame = linestart.CFrame
local sliderpart = sliderclone.SliderPart
local movingsliderpart = sliderclone.Part
local weld = Instance.new("Weld")
weld.Part0 = character.Head
weld.Part1 = sliderpart
weld.C1 = CFrame.new(0,-0.9,0)
weld.Parent = sliderpart
sliderpart.CFrame = character.Head.CFrame
local tweeninfo = TweenInfo.new(speed.Value)
local goal = {}
goal.CFrame = finish.CFrame
local tween = tweenservice:Create(movingsliderpart, tweeninfo, goal)
tween:Play()
local loadanimation = humanoid:LoadAnimation(animation)
loadanimation:Play()
coroutine.wrap(function()
while isonzip and not controls:GetActiveController():GetIsJumping() do
runservice.Heartbeat:Wait()
end
weld:Destroy()
loadanimation:Stop()
sliderclone:Destroy()
isonzip = false
end)()
wait(speed.Value)
weld:Destroy()
loadanimation:Stop()
sliderclone:Destroy()
isonzip = false
end
end)
end
Balloon Script:
repeat wait() until game.Workspace:WaitForChild("Tower of Troubling Tutorials")
local balloons = game.Workspace:WaitForChild("Tower of Troubling Tutorials").Balloons:GetChildren()
local runservice = game:GetService("RunService")
local player = game.Players.LocalPlayer
local playermodule = require(player:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule"))
local controls = playermodule:GetControls()
for i, balloon in pairs(balloons) do
local isonballoon = false
local part = balloon.Part
part.Touched:Connect(function(hit)
local balloonpart = script.Balloon
local timeuntilpop = balloon.TimeUntilPop
local speed = balloon.Speed
local animation = script.BalloonHold
if not isonballoon and player.Character and hit:IsDescendantOf(player.Character) then
isonballoon = true
local character = player.Character
local humanoid = character.Humanoid
local balloonclone = balloonpart:Clone()
local holderpart = balloonclone.Holder
balloonclone.Parent = game.Workspace:WaitForChild("Tower of Troubling Tutorials").Balloons:FindFirstChild(balloon.Name).Part
local weld = Instance.new("Weld")
weld.Part0 = character.Head
weld.Part1 = holderpart
weld.C1 = CFrame.new(0,-0.75,0)
weld.Parent = holderpart
holderpart.CFrame = character.Head.CFrame
local loadanimation = humanoid:LoadAnimation(animation)
loadanimation:Play()
local bodygyro = Instance.new("BodyGyro", balloonclone.Sphere)
bodygyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
bodygyro.CFrame = CFrame.new()
local bodyvelocity = Instance.new("BodyVelocity", balloonclone.Sphere)
bodyvelocity.MaxForce = Vector3.new(0,1000000,0)
bodyvelocity.Velocity = Vector3.new(0,speed.Value,0)
coroutine.wrap(function()
while isonballoon and not controls:GetActiveController():GetIsJumping() do
runservice.Heartbeat:Wait()
end
weld:Destroy()
loadanimation:Stop()
balloonclone:Destroy()
isonballoon = false
end)()
wait(timeuntilpop.Value)
weld:Destroy()
loadanimation:Stop()
balloonclone:Destroy()
bodygyro:Destroy()
bodyvelocity:Destroy()
isonballoon = false
end
end)
end