Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is this error coming up when I run my code? And how can I stop it?

Asked by 4 years ago
Edited 4 years ago

I keep on getting this error when I run this code, but I have no idea why.

01Move.OnServerEvent:Connect(function(person, key, Value, MouseValue)-- Key detection for all players
02    print(Value, CanMove1, grounded)
03    if Value == true and CanMove1 == true and grounded == false then --and MouseValue == false then
04                print(key)
05        if key == W then
06            print(person.name)
07            Name = game.Workspace:WaitForChild(person.name.."Tempman")
08            CanMove2 = true
09            print("Should be true")
10        end if key == A then
11            print(person.name)
12            Name = game.Workspace:WaitForChild(person.name.."Tempman")
13            CanMove3 = true
14        end if key == S then
15            print(person.name)
View all 59 lines...

The error is on the last end. Here is the error

ServerScriptService.Spawn/Move:197: Expected 'end' (to close 'function' at line 129), got <eof>; did you forget to close 'then' at line 169?

2
This code is extremely inefficient. The error in layman's terms means that you forgot to close an open scope, and is instead met with the End Of File. You didn't close your if-block from line 3; there are meant to be four 'end' keywords present. Ziffixture 6913 — 4y
0
Yeah I thought there would probably be a more efficient way to do that, but how? Longjohnnn 28 — 4y
0
Oh wait I see it. Wow that's terrible. Longjohnnn 28 — 4y
0
oh wait Longjohnnn 28 — 4y
View all comments (3 more)
0
this script is for all players in the server hence why I'm not using elseif Longjohnnn 28 — 4y
0
I think it would be a good idea to use one script for all the players movement right? Longjohnnn 28 — 4y
0
Please send me your full code and the :FireServer() code happy_gagarara12 13 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
01Move.OnServerEvent:Connect(function(person, key, Value, MouseValue)-- Key detection for all players
02    print(Value, CanMove1, grounded)
03    if Value == true and CanMove1 == true and grounded == false then --and MouseValue == false then
04        print(key)
05        if key == W then
06            print(person.name)
07            Name = game.Workspace:WaitForChild(person.name.."Tempman")
08            CanMove2 = true
09            print("Should be true")
10        end if key == A then
11            print(person.name)
12            Name = game.Workspace:WaitForChild(person.name.."Tempman")
13            CanMove3 = true
14        end if key == S then
15            print(person.name)
View all 61 lines...

Here, you forgot "end)" at the end of your code. Hope It worked

Edit: you also forgot to close 'then'

Ad

Answer this question