Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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:

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

Log in to vote
0
Answered by 3 years ago

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

0
Didn't work, unfortunately. But thanks for the helping anyway. Va1t_Dev 86 — 3y
Ad

Answer this question