Answered by
p0vd 207
5 years ago Edited 5 years ago
Okay so remember to upvote and accept this if this helped you:
Taking your script you posted you wanted it, FE Compatible correct? Well
remote events are basically telling the client or server to do something. So you need to create a new Remote event anywhere but in this case ReplicatedStorage.
01 | local plyr = game.Players.LocalPlayer |
02 | local mouse = plyr:GetMouse() |
04 | mouse.Button 1 Down:connect( function () |
05 | local part = Instance.new( "Part" , workspace) |
07 | part.Position = mouse.Hit.p |
10 | if hit.Parent:findFirstChild( "Humanoid" ) then |
11 | game.ReplicatedStorage.RemoteEvent:FireServer(hit.Parent.Humanoid, 5 ) |
14 | game.Debris:AddItem(part, 5 ) |
What I've done here is I fired the remote event with the correct arguments. But wait..? Nothing is going to happen because we never told the server what to do! So we need to create an OnServerEvent function.
1 | game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect( function (player,h,d) |
Remote events pass arguments (if needed) to the server. The first parameter on a server event will always be the player instance (because its from the client) so make sure you always put that down.