Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

How can i get the player when using :FireClient?

Asked by
zmonds 7
2 years ago

I've been stuck on this and i can't find anything on the wiki

0
If you're asking 'to who to send it', a handy thing is you can actually send it to everyone using :FireAllClients() RedcommanderV2 1256 — 2y

1 answer

Log in to vote
6
Answered by
Leamir 2963 Moderation Voter Community Moderator
2 years ago
Edited 2 years ago

Hello, zmonds!

On the event, you recive a parameter, the player

I found this scripts on roblox official wiki

-- LocalScript

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = ReplicatedStorage:WaitForChild("CreatePartEvent")

createPartEvent:FireServer()

. . .

-- Script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = Instance.new("RemoteEvent", ReplicatedStorage)
createPartEvent.Name = "CreatePartEvent"

local function onCreatePartFired(player)
    print(player.Name, "wants to create a part")
    local newPart = Instance.new("Part")
    newPart.Position = Vector3.new(0, 20, 0)
    newPart.Parent = game.Workspace
end

createPartEvent.OnServerEvent:Connect(onCreatePartFired)

Good Luck with your games

0
This is what I would consider the best answer RiskoZoSlovenska 373 — 2y
0
Up voted! mixgingengerina10 208 — 2y
Ad

Answer this question