#Fireclient: player argument must be a player argument

27 messages · Page 1 of 1 (latest)

stiff depot
#

I'm trying to fire a client but idk what argument to use to the player

#

-- Services
local repS = game:GetService("ReplicatedStorage")

-- Variables
local loadOn = script.Parent.LoadOn
local loadOff = script.Parent.LoadOff
local areaStats = script.Parent.AreaStats
local eventLoad = repS.LoadEvent
local eventUnload = repS.UnloadEvent

-- Script
loadOn.Touched:Connect(function(hit, plr)
    local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
    if humanoid then
        eventLoad:FireClient(plr)
    end
end)

loadOff.Touched:Connect(function(hit, plr)
    local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
    if humanoid then
        eventUnload:FireClient(plr)
    end
end)

#

what argument can I use?

molten pelican
#

.Touched doesn't pass two arguments, only the hit one

#

u should get the player like this

#

local plr = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)

stiff depot
#

ohh

#

okay

#

Imma test in a while

#

but thank you

#

can you explain for me what is an player argument?

#

I have some doubts abt it

verbal monolith
#

:FireClient(...) requires you to pass the player that you wanna trigger the .OnClientEvent on

stiff depot
#

ohh

fading ridgeBOT
#

studio** You are now Level 2! **studio

stiff depot
#

I understand now

#

and

#

this?

#

-- Check Area's Status
if areaStats.Value == "Workspace" then
    Area1.Parent = game.Workspace
    print("It's On Workspace!")
end

if areaStats.Value == "ServerStorage" then
    Area1.Parent = game.ServerStorage
    print("It's On ServerStorage")
end

#

I wanted to change the value

stiff depot
#

I changed

#

-- Check Area's Status
if areaStats.Value == true then
    Area1.Parent = game.Workspace
    print("It's On Workspace!")
end

if areaStats.Value == false then
    Area1.Parent = game.ServerStorage
    print("It's On ServerStorage")
end

#

but still

stiff depot