How in the world, this keeps erroring? [PLEASE HELP!]
Well I made this door that activates with spacebar once the players torso is touching the part defined, but the thing is the script will run find the door will open and close, but 2 things the user can "spam" the spacebar and break it and once the script runs once and i try to run it again it jitters and won't slide the right way, here is the link?
www.roblox.com/SH-item?id=163931688
01 | local open = script.Parent.Parent.DoorPart.Open |
02 | local close = script.Parent.Parent.DoorPart.Closed |
04 | if script.Running.Value = = true then |
06 | script.Running.Value = true |
07 | while true do wait( 0.1 ) |
08 | if open.Value = = false then |
10 | for i = 1 , 4.9 , 0.1 do |
11 | script.Parent.CFrame = script.Parent.CFrame*CFrame.new( 0.2 , 0 , 0 ) |
18 | else if open.Value = = true then |
19 | while true do wait( 0.1 ) |
20 | if open.Value = = true then |
22 | for i = 1 , 4.9 , 0.1 do |
23 | script.Parent.CFrame = script.Parent.CFrame*CFrame.new(- 0.2 , 0 , 0 ) |
29 | script.Running.Value = false |
01 | local PLR = game.Players.LocalPlayer |
02 | PLR.Character [ "Torso" ] .Touched:connect( function (hit) |
03 | if hit.Name = = "DoorOpen" then |
04 | game.Players.LocalPlayer:GetMouse().KeyDown:connect( function (key) |
06 | if hit.Parent.DoorPart.Script.Running.Value ~ = false and hit.Parent.DoorPart.Open.Value ~ = false then |
07 | print "OpenWithLocalScript" |
08 | hit.Parent.DoorPart.Script.Disabled = false |
10 | hit.Parent.DoorPart.Script.Disabled = true |
12 | if hit.Parent.DoorPart.Script.Running.Value ~ = true then |