Answered by
6 years ago Edited 6 years ago
As the comments said, you can't get the LocalPlayer from a server script. What you can do though is get the character from the parent of the touching part.
01 | local BodyVel = Instance.new( "BodyVelocity" ) |
02 | local WALLorDOOR = script.Parent.Parent.WallToBrake |
05 | local plr = game.Players:GetPlayerFromCharacter(hit.Parent) |
08 | local char = plr.Character |
09 | local FourArms = char.Head.face.Texture |
11 | BodyVel.Parent = game.Workspace.RockBuilding.WallToBrake.Brake 1 |
12 | BodyVel.Velocity = Vector 3. new( 0 , - 15 , 0 ) |
13 | BodyVel.Parent = game.Workspace.RockBuilding.WallToBrake.Brake 2 |
14 | BodyVel.Velocity = Vector 3. new( 0 , - 15 , 0 ) |
15 | BodyVel.Parent = game.Workspace.RockBuilding.WallToBrake.Brake 3 |
16 | BodyVel.Velocity = Vector 3. new( 0 , - 15 , 0 ) |
17 | BodyVel.Parent = game.Workspace.RockBuilding.WallToBrake.Brake 4 |
18 | BodyVel.Velocity = Vector 3. new( 0 , - 15 , 0 ) |
19 | BodyVel.Parent = game.Workspace.RockBuilding.WallToBrake.Brake 5 |
20 | BodyVel.Velocity = Vector 3. new( 0 , - 15 , 0 ) |
21 | WALLorDOOR.Brake 1. Anchored = false |
22 | WALLorDOOR.Brake 2. Anchored = false |
23 | WALLorDOOR.Brake 3. Anchored = false |
24 | WALLorDOOR.Brake 4. Anchored = false |
25 | WALLorDOOR.Brake 5. Anchored = false |
30 | WALLorDOOR:GetChildren() |
35 | script.Parent.Parent.WallToBrake.Brake 1. Touched:Connect(onTouch) |