Script working on studio but not in main game

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)

1 Like

Is there any particular thing about the zipline script that’s not working, or it does not work at all, like nothing happens?

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

Have you made sure that you committed the script and published the game?
Edit: Nvm i see your edit

watch the attached videos to see

Is there some sort of :IsStudio() check going on?

Is this a game published to a group? If so you need to also upload animations to the group.

its not in a group and the problem isnt the animation

no, the whole script is that nothing else is used

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)

the baby ninja posted go there see

print(“Script has created a variable and a function”) was the last print isnt printing when the proximityprompt is triggered

Your script must be a child of the proximity prompt I believe.

No I dont think it matters where the script is placed. That may not be the issue

so why is it working on the studio but no in main game

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.

wdym look to the hierarchy and im going to try put the script in the promixityprompt

1 Like

Thats what i meant by hierarchy, the way things are placed within each other in the hierarchy of the explorer.

i tested put the script in the pp and didnt work and what should i do in the hierarchy

That was changing the hierarchy… did you change the location of the PP in the script too?