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

'FireClient: player agument must be a Player object'?

I'm trying to make a script that locally changes the audio volume if you touch a brick the title is the output in the server when i try to make the script run

server script in the brick

local remote = game.ReplicatedStorage.sounderemote
local players = game:GetService("Players")
script.Parent.Touched:Connect(function(hit)
    local plr = players:GetPlayerFromCharacter(hit.Parent)
if plr then
   remote:FireClient(plr)
end
end)

local script inside of sound in playergui

local remote = game.ReplicatedStorage.sounderemote

remote.OnClientEvent:Connect(function()
	script.Parent.Volume=.1
end)

5 comments

0

hit.Parent is a Character , It's like 'game.Workspace.retracee.LeftLeg'. You could get playerFromChar

0

What..? ^ He did that.

0

Are you positive this script is erroring on line 7 (Server)? You are definitely passing the player as the first argument

0

Oppsss, mybad . line 7: end is an enclosing the 'if' condition . Player is required for it

0

yes it says in the logs on the server error line 6

1 answer

Try changing hit.Parent as your argument on line 7, to just hit

1 comment

0

Could've been a comment

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