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 3 years ago
Edited 3 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:

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Down:Connect(function()
script.Parent.Fire:FireServer()
print("Fired")
end)

normal script:

-->>Variables<<--
local player = game.Players.LocalPlayer
local Attack = game.ReplicatedStorage.Attack
local Tool = script.Parent

-->>Events<<--
script.Parent.Fire:Connect(function(player, argument)
Attack:Clone()
Attack.Parent = Tool.Parent
Attack.Position = script.Parent.Parent.Torso.Position
Attack.Velocity = Vector3.new(10, 0, 0)
Attack.Orientation = script.Parent.Parent.Torso.Orientation
wait(10)
Attack:Destroy()
end)

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 — 3y

1 answer

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

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

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

Answer this question