01 | --NOT MINE |
02 |
03 | local Player = game.Players.LocalPlayer |
04 | local Chr = Player.Character or Player.CharacterAdded:Wait() |
05 | local Mouse = Player:GetMouse() |
06 | local Tool = script.Parent |
07 | local Mode |
08 | local Torso |
09 | local Using = false |
10 | local PTorso |
11 | local RemoteEvent = script.Parent.RemoteEvent --- Problem here Any Idea |
12 |
13 | if Chr:FindFirstChild 'UpperTorso' then |
14 | PTorso = Chr.UpperTorso |
15 | else |
Try to make it wait for child, such as this
1 | local RemoteEvent = script.Parent:WaitForChild( "RemoteEvent" ) |
It seems you have a RemoteEvent inside the client where the server can not access. The best place to put RemoteEvents is in ReplicatedStorage as it is shared between the server and the client. I'm assuming that code is in a LocalScript somewhere on the client where it will actually run, i.e not ReplicatedStorage or Workspace. So you need to put your event in ReplicatedStorage and change your event variable to this:
1 | local RemoteEvent = game.ReplicatedStorage:WaitForChild( "RemoteEvent" ) |
Accept if this helped