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

Fire Client: player argument must be an object?

    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

✓ Accepted answer
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

1 comment

0

ok thanks!

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