I have a very weird problem in my game. It’s quite rare so it would be hard to get a video of it sadly, but I’ll explain it to the best of my abilities. Basically, the game is a Doors style game, but sometimes when I open a door, it either slams shut then re-opens instantly, or slightly wiggles and then is instantly fully open. I rigged the door and used Moon Animator to animate the door opening, and then used the following script for the door opening (it’s bad I know)
local a
--local runService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local part = script.Parent.Parent.Parent.Parent.End
local random = Random.new(game.ReplicatedStorage.Seed.Value)
local previousRoom = game.ReplicatedStorage.PreviousRoom
local rooms
script.Parent.Triggered:Connect(function()
if not script.Parent.Parent.Parent.Open.Value then script.Parent.Parent.Parent.Open.Value = true else return end
rooms = game.ReplicatedStorage.Rooms:GetChildren()
table.sort(rooms, function(a, b) return a.Name < b.Name end)
local room = rooms[math.random(1,#rooms)]
while previousRoom.Value == room.Name do
room = rooms[math.random(1,#rooms)]
task.wait()
end
local roomClone = room:Clone()
roomClone:PivotTo(part.CFrame)
workspace.DoorNumberChanger:Fire(roomClone)
roomClone.Parent = workspace
previousRoom.Value = room.Name
a = script.Parent.Parent.Parent.AnimationController.Animator:LoadAnimation(script.Parent.Parent.Parent.AnimationController.Animator.DoorOpen)
a.Stopped:Connect(function()
a = script.Parent.Parent.Parent.AnimationController.Animator:LoadAnimation(script.Parent.Parent.Parent.AnimationController.Animator.DoorOpened)
a.Looped = true
a:Play()
end)
a:Play()
end)