Okay, so I think I see what the problem is. Here's a list of things you should check...
- GrapplePart doesn't exist in workspace? And since it's using :WaitForChild, the local script will infinitely wait until it find this part, meaning it won't run the rest of the code until GrapplePart is found. So don't add variables that you aren't going to use or it doesn't exist yet.
1 | local GrapplePart = game.Workspace:WaitForChild( "GrapplePart" ) |
You might be placing the scripts in the wrong service. Make sure your SERVER script is in the ServerScriptService, and your LOCAL script is either in the StarterGui or StarterPlayerScripts.
In your server script, you need to recall ReplicatedStorage and search for "held". Because you're doing (held.OnServerEvent), and held is never defined in the server script.
Here's your code cleaned up
Local Script
01 | local RS = game:GetService( "ReplicatedStorage" ) |
02 | local held = RS:WaitForChild( "held" ) |
03 | local Player = game.Players.LocalPlayer |
04 | local Character = Player.Character |
06 | local mouse = game.Players.LocalPlayer:GetMouse() |
07 | local UIS = game:GetService( "UserInputService" ) |
09 | UIS.InputBegan:Connect( function (input) |
10 | if input.UserInputType = = Enum.UserInputType.MouseButton 1 then |
12 | held:FireServer(mouse, true ) |
Server Script
1 | local RS = game:GetService( "ReplicatedStorage" ) |
2 | local held = RS:WaitForChild( "held" ) |
4 | held.OnServerEvent:connect( function (player, mouse, value) |