#why does this not work IntValue
1 messages · Page 1 of 1 (latest)
why does this not work IntValue
“why does this not work IntValue”, it's not completely clear, i don't understand what you mean. I assume you aretrying to access the value from the client, which wouldn’t work unless it’s replicated so...
If you put an IntValue directly inside a Player object, only the server can see it. If you want to access this variable from the client as well, you need to place it somewhere that replicates.
- A common way is to create a leaderstats folder, which is a special folder recognized by Roblox. Any values placed inside leaderstats will be visible to both the server and the client, and they’ll also show up in the in-game leaderboard.
- Or you can create a RemoteEvent and use it to communicate between the server and the client.
sorry it makes the invalue, but for some reason when i call this function:
local function updateUltimateBar(player, amount)
local ultimate = player:FindFirstChild("UltimateValue")
if ultimate then
ultimate.Value = math.clamp(ultimate.Value + amount, 0, 100)
rs.RemoteEvents.TriggerUltimate:FireClient(player, ultimate.Value)
end
end
it does not update
i think the problem is, when i give the parameter player it is the player character and not the player itself. how can i fix this...
no it is not
just tested it
this is the local script for the bar:
local rs = game.ReplicatedStorage
local bar = script.Parent.Frame.Frame.ImageLabel
bar.Size = UDim2.fromScale(0, 1) -- start leeg
rs.RemoteEvents.TriggerUltimate.OnClientEvent:Connect(function(number)
local ultimate = 100
number = math.clamp(number, 0, ultimate)
local progress = number / ultimate
bar.Size = UDim2.fromScale(progress, 1) -- update de breedte
end)
yo man