I have multiple doors in my friends game that are triggered by a key. Each one has it's own activator script in StarterGUI. 3 of them work just fine but this particular one does not want to activate. I get no errors in console when pressing E on this door.
Here is the code: StarterGUI scripts: (Scripts that work just fine)
local HumanoidRootPart = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
local UIS = game:GetService("UserInputService")
local Door = game.Workspace.DoorX.Root
UIS.InputBegan:connect(function(keyCode)
if keyCode.keyCode == Enum.KeyCode.E then
if (Door.Position - HumanoidRootPart.Position).magnitude < 9.5 then
print("E pressed, triggering event....")
game.Workspace.DoorX.RemoteEvent:FireServer()
end
end
end)
(Script of the outlier)
local HumanoidRootPart = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
local UIS = game:GetService("UserInputService")
local Door = game.Workspace.Door2.Root
UIS.InputBegan:connect(function(keyCode)
if keyCode.keyCode == Enum.KeyCode.E then
if (Door.Position - HumanoidRootPart.Position).magnitude < 5 then
print("E pressed, triggering event....")
game.Workspace.Door2.RemoteEvent:FireServer()
end
end
end)
And the scripts of the doors. (Script of the ones that work just fine)
local TweenService = game:GetService("TweenService")
open = false
local Panel = script.Parent
local PanelRoot = Panel.Root
debounce = false
local PanelSwingInfo = TweenInfo.new()
local Event = script.Parent.RemoteEvent
local PanelSwingTween = TweenService:Create(PanelRoot, PanelSwingInfo, {
CFrame = PanelRoot.CFrame * CFrame.Angles(0, math.rad(90), 0)
})
local PanelSwingTweenClose = TweenService:Create(PanelRoot, PanelSwingInfo, {
CFrame = PanelRoot.CFrame * CFrame.Angles(0, -math.rad(0),0)
})
Event.OnServerEvent:Connect(function(Player)
if not debounce then
debounce = true
print("thy event has been triggered")
if open == false then
PanelSwingTween:Play()
script.Parent.Door.door_open:Play()
wait(.40)
script.Parent.Door["Door_Opened (Source)"]:Play()
wait(1.5)
debounce = false
open = true
else
PanelSwingTweenClose:Play()
script.Parent.Door.door_close:play()
wait(1.5)
debounce = false
open = false
end
end
end)
(And the script of the outlier, they might be the exact same, but its always a possibility that somethings differnent.)
local TweenService = game:GetService("TweenService")
open = false
local Panel = script.Parent
local PanelRoot = Panel.Root
debounce = false
local PanelSwingInfo = TweenInfo.new() -- Let's use all defaults here
local Event = script.Parent.RemoteEvent
local PanelSwingTween = TweenService:Create(PanelRoot, PanelSwingInfo, {
CFrame = PanelRoot.CFrame * CFrame.Angles(0, math.rad(90), 0)
})
local PanelSwingTweenClose = TweenService:Create(PanelRoot, PanelSwingInfo, {
CFrame = PanelRoot.CFrame * CFrame.Angles(0, -math.rad(0),0)
})
Event.OnServerEvent:Connect(function(Player)
if not debounce then
debounce = true
print("thy event has been triggered")
if open == false then
PanelSwingTween:Play()
script.Parent.Door.door_open:Play()
wait(.40)
script.Parent.Door["Door_Opened (Source)"]:Play()
wait(1.5)
debounce = false
open = true
else
PanelSwingTweenClose:Play()
script.Parent.Door.door_close:play()
wait(1.5)
debounce = false
open = false
end
end
end)
If this confused you, I am sorry. I would be confused too. I will give some extra info: The root is the only anchored part, (the one that swings and is welded to Door) Everything else is unanchored. Before you ask: yes, all those scripts are committed. I'll edit this with extra info.
