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

Fire Client: player argument must be an object?

Asked by 5 years ago
Edited 5 years ago
    local sound = "rbxassetid://205050022"

script.Parent.Touched:Connect(function(hit)

if hit.Parent:FindFirstChild("Humanoid") then

local player = game.Players:GetPlayerFromCharacter(hit.Parent)

game.ReplicatedStorage.PlayMusic:FireClient(player,sound)

end

end)

y doesn't this work?

1 answer

Log in to vote
0
Answered by 5 years ago
local sound = "rbxassetid://205050022"

local Players = game:GetService("Players")

script.Parent.Touched:Connect(function(hit)

    if hit.Parent:FindFirstChild("Humanoid") then

        local player = Players:GetPlayerFromCharacter(hit.Parent)



    end

end)

Not really sure why it worked after i did it but all i did was add local Players = game:GetService("Players") and replaced game.Players with just Players "Players:GetPlayerFromCharacter(hit.Parent)" in this line GetPlayerFromCharacter

0
ok thanks! Clasterboy 72 — 5y
Ad

Answer this question