Why does not work?

hi so i am getting this dumb error:

attempt to perform arithmetic (add) on nil and number - Client - LocalScript:4

idk why it ist working heres a server script

script.Parent.ClickDetector.MouseClick:Connect(function(plrWhoClicked)
	game.ReplicatedStorage.KeyboardClean:FireClient(plrWhoClicked, script.Parent.Transparency)
end)

heres the client script:

local KeyboardClean = game.ReplicatedStorage:WaitForChild("KeyboardClean")

KeyboardClean.OnClientEvent:Connect(function(player, clean)
	clean += 0.1
end)

please help

Try doing this first and see what it prints:

script.Parent.ClickDetector.MouseClick:Connect(function(plrWhoClicked)
	print(script.Parent.Transparency);
end)
1 Like

dont use player as an argument from the client, remove the player argument from onClientEvent

KeyboardClean.OnClientEvent:Connect(function(clean)
	clean += 0.1
end)
1 Like

Hi guys uh this ist really working thanks tho

why? have you tried my code yet?

1 Like

Yeah i tried it but it just cant work

try this

script.Parent.ClickDetector.MouseClick:Connect(function(plrWhoClicked)
	game.ReplicatedStorage.KeyboardClean:FireClient(plrWhoClicked, script.Parent)
end)
local KeyboardClean = game.ReplicatedStorage:WaitForChild("KeyboardClean")

KeyboardClean.OnClientEvent:Connect(function(clean)
	clean.Transparency += 0.1
end)

before you were just adding varibale value now it should change transparency

1 Like

oh my gosh this works thank you, Also thanks everyone who replied!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.