Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

unable to cast value to object?

Asked by 2 years ago

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)
0
what is the error? spaspootootoo 0 — 2y
0
Is the error in the arguments or is it in the function on line 8 Hi_People1133 218 — 2y
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) Not_prototype 50 — 2y
0
is maxStamina an IntValue as well? On both line 4 and 8 it should be maxStamina.Value Miniller 562 — 2y
0
max stamina is a float not an actually object its a variable i made local maxStamina = 500 Not_prototype 50 — 2y

Answer this question