Guys im trying to make a real life parkour game and in the zipline script its working in the studio but not in the main game, and it doesnt show any error (in the studio no one appears as well), i tried to add and remove variables and if’s but it stop or return to work only in the studio, in the main game keep not working
local pp = script.Parent.Start.Pp
function soltar(hrp,anim,hum)
hrp.Anchored = false
hum.AutoRotate = true
anim:Stop()
end
pp.Triggered:Connect(function(plr)
local char = plr.Character
pp.Enabled = false
local parte1 = script.Parent.End
local parte2 = script.Parent.Start
local hrp = char:FindFirstChild("HumanoidRootPart")
local hum = char:FindFirstChild("Humanoid")
if hrp and hum then
local speed = .5
local multiplier = 1.0225
hrp.Anchored = true
hum.AutoRotate = false
local ziplineOffset = Vector3.new(0, hrp.Size.Y * 1.3, 0)
local distance = (parte1.Position - parte2.Position).Magnitude
hrp.CFrame = parte2.CFrame - ziplineOffset
local anim = hrp.Parent.Humanoid:LoadAnimation(script.Parent.baixo)
anim:Play()
while wait() do
-------------------------------------------
if char.cancelar.Value == true then
soltar(hrp,anim,hum)
break
end
-------------------------------------------
hrp.CFrame = hrp.CFrame:Lerp(parte1.CFrame - ziplineOffset, speed / distance)
speed *= multiplier
if (hrp.Position - parte1.Position).Magnitude <=5 then
soltar(hrp,anim,hum)
break
end
end
end
pp.Enabled = true
end)
in the studio everthing happen as it should be, but in main game i press the button but nothing happen its like if i hasnt pressed
edit: yes i did
lemme try to upload videos to explain
I see. Have you tried printing messages at different parts of the script? If not, do that so we can see where the script may stop running when in-game. And also send a screenshot of the output in studio and in-game.
Here is the script with added prints, I did not change anything else:
print("Script has started running")
local pp = script.Parent.Start.Pp
function soltar(hrp,anim,hum)
hrp.Anchored = false
hum.AutoRotate = true
anim:Stop()
end
print("Script has created a variable and a function")
pp.Triggered:Connect(function(plr)
print("Trigger Detected")
local char = plr.Character
pp.Enabled = false
local parte1 = script.Parent.End
local parte2 = script.Parent.Start
local hrp = char:FindFirstChild("HumanoidRootPart")
local hum = char:FindFirstChild("Humanoid")
print("Created variables upon trigger")
if hrp and hum then
print("If statement checked")
local speed = .5
local multiplier = 1.0225
hrp.Anchored = true
hum.AutoRotate = false
local ziplineOffset = Vector3.new(0, hrp.Size.Y * 1.3, 0)
local distance = (parte1.Position - parte2.Position).Magnitude
hrp.CFrame = parte2.CFrame - ziplineOffset
local anim = hrp.Parent.Humanoid:LoadAnimation(script.Parent.baixo)
anim:Play()
print("Ran the code above")
while wait() do
-------------------------------------------
if char.cancelar.Value == true then
soltar(hrp,anim,hum)
break
end
-------------------------------------------
hrp.CFrame = hrp.CFrame:Lerp(parte1.CFrame - ziplineOffset, speed / distance)
speed *= multiplier
if (hrp.Position - parte1.Position).Magnitude <=5 then
soltar(hrp,anim,hum)
break
end
print("Loop currently running")
end
end
pp.Enabled = true
print("end of the code")
end)
Usually difference between studio and game is how and when the character loads in… so I would look to your hierarchy and how your script handles the character.