So i have a weld constraint connecting a door to a hinge, and on a proximity prompt, opens the door. heres the problem: the door isnt opening. i verified the hinge moves, and just setting the orientation does indeed open the door, so i dont know what the problem is?
the door is not anchored
when i manually open the door, and then activate the prompt, the door just teleports back to being closed?
the black part is the hinge, and usually is transparency 1, it is at 0 to show the hinge
the model has no primary part. the door is a union, heres the script that handles the door opening
the hinge indeed tweens, but the door doesnt follow the tween
while true do
script.Parent.Triggered:Connect(function()
game:GetService("TweenService"):Create(script.Parent.Parent.Parent.DoorHinge, TweenInfo.new(0.5), {Orientation = Vector3.new(0, -105, 0)}):Play()
end)
task.wait()
end
You are causing performance issues by constantly connecting to the same event. Once you connect to an event, the function will run for as many times as the event fires until you disconnect the connection.
local part = script.Parent.Parent -- Door
local pos = part.Position + Vector3.new(0,50,0) -- Your position
local rot = part.CFrame - part.CFrame.Position
script.Parent.TriggerEnded:Connect(function()
game:GetService("TweenService"):Create(script.Parent.Parent, TweenInfo.new(1), {CFrame = CFrame.new(pos) * rot}):Play()
end)
Your position, make sure the door is unanchored while the hinge is anchored.
local part = script.Parent.Parent -- Door
local pos = part.Position + Vector3.new(0,50,0) -- Your position
local rot = part.CFrame - part.CFrame.Position
script.Parent.TriggerEnded:Connect(function()
game:GetService("TweenService"):Create(script.Parent.Parent, TweenInfo.new(1), {CFrame = CFrame.Angles(pos) * rot}):Play()
end)