Hi so i am trying to send some info of a parts transparency from server to client? but i keep getting this stupid error from the servers side
FireClient: player argument must be a Player object - Server - Script:4
this is the script for the server side:
script.Parent.ClickDetector.MouseClick:Connect(function(clicked)
print(clicked)
local Player = game.Players:FindFirstChild(clicked.Parent.Name)
game.ReplicatedStorage.KeyboardClean:FireClient(Player, script.Parent.Transparency)
end)
--client side
local KeyboardClean = game.ReplicatedStorage:WaitForChild("KeyboardClean")
KeyboardClean.OnClientEvent:Connect(function(player, clean)
clean.Transparency = 1
end)
so how do i fix this?
Bikereh
(green_lady)
#2
script.Parent.ClickDetector.MouseClick:Connect(function(plrWhoClicked)
game.ReplicatedStorage.KeyboardClean:FireClient(plrWhoClicked, script.Parent.Transparency)
end)
change the server side to this.
the click detector returns the player who clicked it so you can use that
Hi thanks so much this works but the only problem is i have a issue with the local script error
Players.arifgamer332.PlayerScripts.LocalScript:4: attempt to perform arithmetic (add) on nil and number - Client - LocalScript:4
heres the client script:
local KeyboardClean = game.ReplicatedStorage:WaitForChild("KeyboardClean")
KeyboardClean.OnClientEvent:Connect(function(player, clean)
clean += 0.1
end)