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

How can I get when the remote event is fired?

Asked by 4 years ago
Edited 4 years ago

So, Im trying to make a projectile attack however it isn't working.

so both the scripts are both in a tool with a remote event named Fire

local script:

1local Player = game.Players.LocalPlayer
2local Mouse = Player:GetMouse()
3Mouse.Button1Down:Connect(function()
4script.Parent.Fire:FireServer()
5print("Fired")
6end)

normal script:

01-->>Variables<<--
02local player = game.Players.LocalPlayer
03local Attack = game.ReplicatedStorage.Attack
04local Tool = script.Parent
05 
06-->>Events<<--
07script.Parent.Fire:Connect(function(player, argument)
08Attack:Clone()
09Attack.Parent = Tool.Parent
10Attack.Position = script.Parent.Parent.Torso.Position
11Attack.Velocity = Vector3.new(10, 0, 0)
12Attack.Orientation = script.Parent.Parent.Torso.Orientation
13wait(10)
14Attack:Destroy()
15end)

If I can get some help figuring this out it would be greatly appreciated im new to scripting, Thanks!

1
You can check when a remote event is fired by using .OnClientEvent or .OnServerEvent JustinWe12 723 — 4y

1 answer

Log in to vote
1
Answered by
Omzure 94
4 years ago

You can put a script inside serverscriptservice, and when the event is fired, you can run the script

1game.ReplicatedStorage.RemoteEvents.Event.OnServerEvent:Connect(function()
2    --script
3end)
Ad

Answer this question