You can write your topic however you want, but you need to answer these questions:
I have placed 4 ObjectValues inside a script, that determines the stats of an attack. There are 3 StringValue and 1 IntValue, i simply need to update them whenever the attack gets spawned
In the script that updates the object values everything works well, except when it’s about updating the IntValue, that remains 0 and doesn’t change.
I’ve alredy triple checked everything, the path to the intvalue is correct and the script actually works fine since it’s update without problems the 3 stringvalues.
This is the script i’m using, it’s suddivide in 4 parts, The first defining the variables which is just a bunch of locals, a piece of code that calculates the coordinates of the spawnpoint of the attacks, after the attack gets spawned then the scripts updates the 4 objectvalues inside every clone to match the ones defined in the first part, and at last the clone gets animated.
As i repeat everything works perfectly fine, the attack is a pillar that spawn from the ground in random places, it gets choosen the random point where it needs to spawn , then the values inside the clone gets changed and at last it gets animated. BUT the string Value remains 0 and doesn’t change
EStats.Attack1 = function(WalkingZone,EnemySpot,Spikes)
local Atks = 15
local FireRate = 10
local Lifetime = 5
local Percent = .45
local Scaling = "ATK"
local Color = "Green"
local Type = "Magical"
task.spawn(function()
while task.wait(FireRate) do
local WSpot = WalkingZone.Position -- Starting position to place the clone
local r = WalkingZone.Size.Y/2 -- Radius of the circle
for i=1, Atks do
local RandomX = math.random(WSpot.X - r + 1, WSpot.X + r - 1)
local c = -(2*WSpot.X*RandomX-math.pow(RandomX,2)-math.pow(WSpot.X,2)-math.pow(WSpot.Z,2)+math.pow(r,2))
local b = -2*WSpot.Z
local delta = math.pow(b,2)-4*c
local Z1 = (-b - math.sqrt(delta))/2
local Z2 = (-b + math.sqrt(delta))/2
local RandomZ = math.random(Z1 + 1,Z2 - 1)
task.wait(.05) -- little delay so it's cooler
local Clone = Spikes:Clone()
-- Applying stats
local EHitStats = Clone.EHitStats
EHitStats.Percentage.Value = Percent -- This one is the intvalue that doesn't get updated
EHitStats.Color.Value = Color
EHitStats.Type.Value = Type
EHitStats.Scaling.Value = Scaling
-- Animating
local Animator = Clone.AnimationController.Animator
local SpykeRush = Clone["Spike Rush"]
Clone.PrimaryPart.CFrame = CFrame.new(RandomX, EnemySpot.Position.Y, RandomZ)*CFrame.Angles(0,0,math.rad(90))
Clone.Parent = EnemySpot["Evil Bush"].Combat
game:GetService('RunService').Stepped:Wait()
local Anim = Animator:LoadAnimation(SpykeRush)
Anim:Play()
task.delay(Lifetime,Clone.Destroy,Clone)
end
end
end)
end