im trying to send data to a local script but whenever i try i get this error on line 8

players.PlayerAdded:Connect(function(player)

	local stamina = Instance.new("IntValue", player)
	stamina.Value = maxStamina
	stamina.Name = "Stamina"
	
	stamina.Changed:Connect(function(player)
		rs.StaminaUpdate:FireClient(player, stamina.Value, maxStamina)
	end)
end)

5 comments

0

what is the error?

0

Is the error in the arguments or is it in the function on line 8

0

the error is unable to cast value to object and i think its the part where i fireclient and send the data (player, stamina,Value, maxStamina)

0

is maxStamina an IntValue as well? On both line 4 and 8 it should be maxStamina.Value

0

max stamina is a float not an actually object its a variable i made local maxStamina = 500