So im trying to make it that players can only place stuff 5 times but idk how. What should i do?
i tired using this tutorial but it dosent work
Here is the model:
So im trying to make it that players can only place stuff 5 times but idk how. What should i do?
i tired using this tutorial but it dosent work
Here is the model:
I’m a bit too tired to look through all of this code right now, but this is the basic logic of how you’d go about that:
local max = 5
local count = 0
function SomeAction()
if count < max then
count += 1
-- do action
end
end
Detect when the NumberValue or something else is changed and then check if the value is greater than the MaxValue. If greater, then basically set the value to MaxValue.
Same goes for MinValue, just check if smaller than.
umm actually sir if statements exist, you could perform an if statement on the number before doing whatever you are trying to do
The following object is deprecated but is still functional.
https://developer.roblox.com/en-us/api-reference/class/IntConstrainedValue
Ideally, you should be using the available ‘math’ library functions in order to contrain/clamp values.
math.min
returns the minimum value of a set of values. math.min(1, 2) -1
math.min
returns the maximum value of a set of values. math.max(1, 2) -2
math.clamp
clamps a single value between two other values. math.clamp(math.pi, 0, 10) --3.14...