#why does this not work IntValue

1 messages · Page 1 of 1 (latest)

river spruce
#

game.Players.PlayerAdded:Connect(function(player)
-- Maak de Ultimate IntValue aan
local ultimateValue = Instance.new("IntValue")
ultimateValue.Name = "UltimateValue"
ultimateValue.Value = 0 -- start leeg
ultimateValue.Parent = player
print("UltimateValue aangemaakt voor", player.Name)
end)

#

it is server script

river spruce
#

why does this not work IntValue

mental zinc
#

“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.
river spruce
#

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