Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I get when the remote event is fired?

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 comment

1

You can check when a remote event is fired by using .OnClientEvent or .OnServerEvent

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.