nope there are no errors
door doesnt open
How did it open before if the code didnāt work
well, what i needed was the prompts to say close door when it was open and open door when it was closed
The code you sent before was broken and didnāt work so perhaps you messed it up while posting it?
the door script worked fine before
local Hinge = script.Parent.PrimaryPart
local opened = false
local Promt = script.Parent:WaitForChild("ProximityPrompt")
function OpenDoor()
if opened == false then
opened = true
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(5), 0))
wait()
end
else
opened = false
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.Angles(0, math.rad(-5), 0))
wait()
end
end
end
Promt.Triggered:Connect(function(Players)
OpenDoor()
end)
script.Parent.Door.ProxomityPrompt.Triggered:Connect(OpenDoor)
Thatās kinda awfully slow for a opening animation, are you aware that Radians
go from where the Unit Circle startsā¦?
local Hinge = script.Parent.PrimaryPart
local opened = false
local RunService = game:GetService("RunService")
local prompt = script.Parent.ProximityPrompt
function OpenDoor()
if opened == false then
opened = true
prompt.ActionText = "Close Door"
for i = 0, 75, 1 do
Hinge.CFrame = Hinge.CFrame*CFrame.Angles(0, math.rad(i), 0)
RunService.Heartbeat:Wait()
end
elseif opened == true then
opened = false
prompt.ActionText = "Open Door"
for i = 75, 0, -1 do
Hinge.CFrame = Hinge.CFrame*CFrame.Angles(0, math.rad(i), 0)
RunService.Heartbeat:Wait()
end
end
end
shall i just put the old script to open the door in there?
You could first try my script and see if anything changes at all, I think I did mess something up with the CFrames
however
that doesnt seem to work too
Could you try adding some random print("Hello this is a test")
statements in the script to see what outputs back?
If Jackscarlettās script doesnāt work you can try using this one. In theory it should work
local Hinge = script.Parent.PrimaryPart
local opened = false
local Promt = script.Parent:WaitForChild("ProximityPrompt")
local RunService = game:GetService("RunService")
function OpenDoor()
if opened == false then
opened = true
for i = 1, 21 do
Hinge.CFrame = Hinge.CFrame*CFrame.Angles(math.rad(5), 0, 0)
RunService.Heartbeat:Wait()
end
Promt.ActionText = "Close Door"
script.Parent.Door.ProximityPrompt.Action = "Close Door"
else
opened = false
for i = 1, 21 do
Hinge.CFrame = Hinge.CFrame*CFrame.Angles(math.rad(-5), 0, 0)
RunService.Heartbeat:Wait()
end
Promt.ActionText = "Open Door"
script.Parent.Door.ProximityPrompt.Action = "Open Door"
end
end
Promt.Triggered:Connect(function(Players)
OpenDoor()
end)
script.Parent.Door.ProximityPrompt.Triggered:Connect(OpenDoor)
it does this now
Is that the hinge? if so make sure to weld it to the actual door. If both of those donāt work then try this:
local Hinge = script.Parent.PrimaryPart
local opened = false
local Promt = script.Parent:WaitForChild("ProximityPrompt")
local RunService = game:GetService("RunService")
function OpenDoor()
if opened == false then
opened = true
for i = 1, 21 do
Hinge.CFrame = Hinge.CFrame*CFrame.Angles(0, math.rad(5), 0)
RunService.Heartbeat:Wait()
end
Promt.ActionText = "Close Door"
script.Parent.Door.ProxomityPrompt.Action = "Close Door"
else
opened = false
for i = 1, 21 do
Hinge.CFrame = Hinge.CFrame*CFrame.Angles(0, math.rad(-5), 0)
RunService.Heartbeat:Wait()
end
Promt.ActionText = "Open Door"
script.Parent.Door.ProxomityPrompt.Action = "Open Door"
end
end
Promt.Triggered:Connect(function(Players)
OpenDoor()
end)
script.Parent.Door.ProxomityPrompt.Triggered:Connect(OpenDoor)
Did you type the name of the door correctly? and set its location correctly?
Iāve made a door like this before, I just make a separate proximity prompt that gets enabled once the first proximity prompt is triggered. I know itās not a very clean solution, but it does get the job somewhat done.
thats smart and probably easier to do can you possibly send the code for that?
Iāve made an entire game out of that, here is some basic code:
Made in forum
First script:
script.Parent.TriggerEnded:Connect(function()
script.Parent.Parent.Parent.Parent.Door.Transparency = 1
script.Parent.Parent.Parent.Parent.Door.CanCollide = false
script.Parent.Parent.Parent.Attachment2.ProximityPrompt.Enabled = true
script.Parent.Enabled = false
end)
Second script:
script.Parent.TriggerEnded:Connect(function()
script.Parent.Parent.Parent.Parent.Door.Transparency = 0
script.Parent.Parent.Parent.Parent.Door.CanCollide = true
script.Parent.Parent.Parent.Attachment1.ProximityPrompt.Enabled = true
script.Parent.Enabled = false
end)
Just swap that out for the door opening, I would personally make a door opening animation and make that play using an animation controller, and when the animation begins, make the door cancollide false, then make when it is done, angle the door to look open and then make it cancollide true.