Script works pretty well in Studio, but breaks when I play as a normal game. What's the problem?
Asked by
3 years ago Edited 3 years ago
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:
02 | script.Parent.ClickDetector.MaxActivationDistance = 0 |
03 | if script.Parent.Parent.isOpen.Value = = false then |
04 | script.Parent.DoorOpen:Play() |
05 | script.Parent.ClickDetector.MaxActivationDistance = 0 |
07 | script.Parent.Parent:SetPrimaryPartCFrame(script.Parent.Parent.PrimaryPart.CFrame * CFrame.fromOrientation( 0 , -. 05 , 0 )) |
10 | script.Parent.Parent.isOpen.Value = true |
12 | script.Parent.ClickDetector.MaxActivationDistance = 10 |
14 | script.Parent.ClickDetector.MaxActivationDistance = 0 |
15 | script.Parent.DoorClose.Script.Disabled = false |
17 | script.Parent.Parent:SetPrimaryPartCFrame(script.Parent.Parent.PrimaryPart.CFrame * CFrame.fromOrientation( 0 , . 05 , 0 )) |
20 | script.Parent.Parent.isOpen.Value = false |
22 | script.Parent.ClickDetector.MaxActivationDistance = 10 |
25 | script.Parent.ClickDetector.MouseClick:Connect(onClick) |