Click to FireClient

I have a script that is supposed to fire a remote event but it doesn’t

``local click = script.Parent.ClickDetector
local Part1 = game.Workspace.Dirt.one
local part2 = game.Workspace.Dirt.two
local part3 = game.Workspace.Dirt.three

click.MouseClick:Connect(function()
Part1.Transparency = 1
Part1.CanCollide = false
part2.Transparency = 1
part2.CanCollide = false
part3.Transparency = 1
part3.CanCollide = false

game.ReplicatedStorage.Remotes.Objective.NoShovel:FireClient()

end)`` Why wont it work?

To which client are you firing to?

just a remote event in replicatedstorage

Oh deary me I’m not very up to date on ClickDetectors… Sorry about that. They do indeed allow server click interaction, my apologies. But as Kiyan was inquiring, you may find that FireClient(Player *p, …) is the correct calling format for FireClient.

There is no parameter in :FireClient(), you have to fire with the player object.

click.MouseClick:Connect(function(plrwhoclicked) -- parameter of the player who clicked
Part1.Transparency = 1
Part1.CanCollide = false
part2.Transparency = 1
part2.CanCollide = false
part3.Transparency = 1
part3.CanCollide = false

game.ReplicatedStorage.Remotes.Objective.NoShovel:FireClient(plrwhoclicked) -- firing to the client with the player 
end)

Edit1: Forgot to include end)

3 Likes

maybe? make the click just fire the event, make another script edit the transparency and collison?

1 Like

FireClient() gets Player as first argument, you may get it through MouseClick:Connect(function(Player) and then do RemoteEvent:FireClient(Player).