Why doesn't my door open when I press E?
Hi, why doesn't my door open?
02 | local open = script.Parent.Open |
03 | local ind = script.Parent.Tuer |
05 | script.Parent.CardScanner.Scanner.Touched:Connect( function (p) |
08 | if p.Parent:FindFirstChild( "12345" ) ~ = nil then |
09 | if open.Value = = false then |
10 | local f = script.Parent.Tuer.PrimaryPart.CFrame*CFrame.Angles( 0 ,math.rad( 90 ), 0 ) |
12 | local cfm = script.Parent.Tuer.PrimaryPart.CFrame:Lerp(f,i) |
13 | script.Parent.Tuer:SetPrimaryPartCFrame(cfm) |
18 | local f 2 = script.Parent.Tuer.PrimaryPart.CFrame*CFrame.Angles( 0 ,-math.rad( 90 ), 0 ) |
20 | local cfm = script.Parent.Tuer.PrimaryPart.CFrame:Lerp(f 2 ,i) |
21 | script.Parent.Tuer:SetPrimaryPartCFrame(cfm) |
27 | print ( "Keycard wurde nicht akzeptiert oder erkannt" ) |
28 | script.Parent.CardScanner.RingLight.BrickColor = BrickColor.new( "Really red" ) |
30 | script.Parent.CardScanner.RingLight.BrickColor = BrickColor.new( "Parsley green" ) |
This script with the keycard reader is working. But this script with the 'Press E to interact' won't work.?
01 | local HumanoidRootPart = game.Players.LocalPlayer.Character:WaitForChild( "HumanoidRootPart" ) |
02 | local UIS = game:GetService( "UserInputService" ) |
03 | local Tuer = script.Parent.Tuer |
04 | local open = script.Parent.Open |
06 | UIS.InputBegan:Connect( function (keycode) |
07 | if keycode.keycode = = Enum.KeyCode.E then |
09 | if (Door.Position - HumanoidRootPart.Position).magnitude < 15 then |
11 | if open.Value = = false then |
12 | local f = script.Parent.Tuer.PrimaryPart.CFrame*CFrame.Angles( 0 ,math.rad( 90 ), 0 ) |
14 | local cfm = script.Parent.Tuer.PrimaryPart.CFrame:Lerp(f,i) |
15 | script.Parent.Tuer:SetPrimaryPartCFrame(cfm) |
20 | local f 2 = script.Parent.Tuer.PrimaryPart.CFrame*CFrame.Angles( 0 ,-math.rad( 90 ), 0 ) |
22 | local cfm = script.Parent.Tuer.PrimaryPart.CFrame:Lerp(f 2 ,i) |
23 | script.Parent.Tuer:SetPrimaryPartCFrame(cfm) |
"Tuer" means "Tür", i.e. door [--- It's german Can you help me? The door should open when the player presses "E" within a radius of 15.
Its a script.
There
s one Error in the Output:
1 | Workspace.Zauntore.Tor.Script: 1 : attempt to index nil with 'Character' - Server - Script: 1 |
3 | Script 'Workspace.Zauntore.Tor.Script' , Line 1 - Studio - Script: 1 |
I once wrote it in a LUA box because otherwise the paragraphs would obscure I hope this can help you find the problem.
PinoRisi03