Ok So I'm trying to make this script fire the OpenDoor Event (there is no errors what so ever) so it can animate a door being opening or closing but it seems I can't get it to open at all.
Events Script It's in ServerScriptService Under a folder called Scripts
workspace:WaitForChild('Events').OpenDoor.OnServerEvent:connect(function(Player, DoorOC) local CheckForTool = false for _,Items in pairs(Player.Character:GetChildren()) do if Items.ClassName == 'Tool' then if Items.Name == 'DoorOC' then CheckForTool = true if DoorOC then DoorOC.CFrame = DoorOC.CFrame * CFrame.new(0,10,0) else DoorOC.CFrame = DoorOC.CFrame * CFrame.new(0,0,0) end end end end end)
Interact Script This is in StarterPack I might had This is suppose to Fire when clicked
elseif Target.Parent.Name == 'Door' then repeat wait() until game.Players.LocalPlayer.Character local Magnitude = (game.Players.LocalPlayer.Character.Torso.Position - Target.Position).magnitude if Magnitude < 10 then workspace.Events.OpenDoor:FireServer(Target.Parent) end
Is your script in a tool? Scripts in the Starterpack or Backpack do not get copied to the player's character when they are used. Try
workspace:WaitForChild('Events').OpenDoor.OnServerEvent:connect(function(Player, DoorOC) local CheckForTool = false for _,Items in pairs(Player.Backpack:GetChildren()) do if Items:IsA("Script") or Items:IsA("LocalScript") then if Items.Name == "DoorOC" then CheckForTool = true if DoorOC then DoorOC.CFrame = DoorOC.CFrame * CFrame.new(0,10,0) else DoorOC.CFrame = DoorOC.CFrame * CFrame.new(0,0,0) end end end end end)
Notice the double quotes around strings. I do not believe you can use character quotes. Also, :IsA() is a nice piece of synactic sugar for doing what you did there with ClassName()
Best of luck(And skillz) --Cantos