This is a script that is inside a "hatchdoor". Everything works perfectly in the studio, but once I enter through the Roblox server it does not. Any ideas?

-- For Air Compression Tank Button Door Hatch Door 1
local sound= script.Parent.Sound
local emit= script.Parent.Parent.emitter
local lever= script.Parent.Parent.Parent.airmachine.handle:FindFirstChild("leverscript")
lever.Disabled= true

wait(0.1)
script.Parent.Anchored = true

function onClicked()

if lever.Disabled== true then
	lever.Disabled = false
else return
end

local char= game.Players.LocalPlayer.Character
	local char= game.Players.LocalPlayer.Character
	local check=char:FindFirstChild("Value")

if check ~= true then
	local value= Instance.new("IntValue")
	value.Parent= char


end
					
			sound:Play()
			
			script.Parent.Anchored = true
			local door = script.Parent.CFrame
			for i = 0,1.5,0.1 do

			wait(0.1)


		emit.ParticleEmitter.Enabled= true

			script.Parent.CFrame = script.Parent.CFrame*CFrame.fromEulerAnglesXYZ(0,0.1,0)*CFrame.new(-0.01,0,0.25)

		

			script.Parent.CFrame = door*CFrame.fromEulerAnglesXYZ(0,math.pi/2,0)*CFrame.new(-2.5,0,2.5)
			script.Parent.Anchored = true
			
			end
			
	
			emit.ParticleEmitter.Enabled= false
wait(3)

			script.Parent.Anchored = true
			local door = script.Parent.CFrame
			for i = 0,1.5,0.1 do
			wait(0.1)
			script.Parent.CFrame = script.Parent.CFrame*CFrame.fromEulerAnglesXYZ(0,-0.1,0)*CFrame.new(0.01,0,-0.25)
			end
		script.Parent.CFrame = door*CFrame.fromEulerAnglesXYZ(0,-math.pi/2,0)*CFrame.new(-2.5,0,-2.5)
		script.Parent.Anchored = true
		

wait(1)

end 


script.Parent.Parent.button.ClickDetector.MouseClick:connect(onClicked)

Thank you for any advice!

4 comments

0

Indent your code. It's messy. Can't help you.

0

Sorry about that, I copied and pasted it and that is how it looked. I didn’t think spaces and weird indentions would cause members to not be able to help. My actual script doesn’t look like this. I can clean it up if you think it’s hard to understand.

0

Local scripts run really fast. This could mean that if you are using a Local Script, the game does not get a chance to load before it fires.

0

No, it’s a normal script. I will add a wait in the beginning and see if that helps.