Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Script works pretty well in Studio, but breaks when I play as a normal game. What's the problem?

Hello. So I'm working on a door script, it works pretty well in Studio, it works in normal game too, but broken. I better explain it with GIFs:

Roblox Studio: https://imgur.com/ahDQ7vr Actual game: https://imgur.com/9YPjYCa

I can't figure out what's the issue. The script works pretty well without any errors, as it should be. I guess it's an engine bug, I don't know if there's a sollution of that issue. Here's the script:

function onClick()
script.Parent.ClickDetector.MaxActivationDistance=0
if script.Parent.Parent.isOpen.Value==false then
		script.Parent.DoorOpen:Play()
		script.Parent.ClickDetector.MaxActivationDistance=0
for i = 1,40 do
		script.Parent.Parent:SetPrimaryPartCFrame(script.Parent.Parent.PrimaryPart.CFrame * CFrame.fromOrientation(0, -.05, 0))
		wait()
end
script.Parent.Parent.isOpen.Value=true
wait(1)
script.Parent.ClickDetector.MaxActivationDistance=10
	else
script.Parent.ClickDetector.MaxActivationDistance=0
script.Parent.DoorClose.Script.Disabled=false
for i = 1,40 do
		script.Parent.Parent:SetPrimaryPartCFrame(script.Parent.Parent.PrimaryPart.CFrame * CFrame.fromOrientation(0, .05, 0))
		wait()
end
script.Parent.Parent.isOpen.Value=false
wait(1)
script.Parent.ClickDetector.MaxActivationDistance=10
end
end
script.Parent.ClickDetector.MouseClick:Connect(onClick)

1 answer

try setting a max torque in the hinge and make the door anchored and un anchored when someone clicks it

1 comment

0

Didn't work, unfortunately. But thanks for the helping anyway.

This discussion is preserved as it was. New answers, comments, and votes are closed.