So I needed help on making a door that “breaks” when you open it like this:
But when I put it in a different direction, it looks weird.
How can I achieve this? This is my script.
local door = script.Parent
local debounce = false
local function getPlayerFromCharacter(character)
for _, player in game:GetService("Players"):GetPlayers() do
if player.Character == character then
return player
end
end
end
door.Touched:Connect(function(player)
if player.Parent:FindFirstChild("Humanoid") then
if not debounce then
player.Parent.HumanoidRootPart.CFrame = door.Parent.TeleportPart.CFrame
player.Parent.HumanoidRootPart.CanCollide = false
player.Parent.Humanoid.WalkSpeed = 0
player.Parent.Humanoid.AutoRotate = false
player.Parent.Humanoid.JumpPower = 0
door.CollisionGroup = "Door"
debounce = true
door.Break:Play()
door.Anchored = false
door.AssemblyLinearVelocity = Vector3.new(0,0,-50)
task.wait(1)
game.ReplicatedStorage.Events.AAAHHHHH:FireClient(getPlayerFromCharacter(player.Parent))
end
end
end)
I didn’t notice that you were using AssemblyLinearVelocity, but the documentation states in cases like this you should probably use a VectorForce or ApplyImpulse for something like this.