My goal is to create a script that lowers the size offset incrementally every time the animation loops.
The only issue I’m having, is for some reason when I try to change the value of the Size to a new UDim2, it doesn’t work. For clarification, the function works perfectly, and when the print line inside of the HasTag check prints, it prints the value that the new offset value should be, but in game it doesn’t actually change? Yet when I change the size offset through a non-local script it works fine…
I’ve been searching for answers for a while but cant find any similar situation the one I’m having.
Please let me know if I need to explain something better, I’m still very new to this forum.
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local mouse = plr:GetMouse()
local cs = game:GetService("CollectionService")
local offset = script.Parent.Health.Size
-- Triggers when animation loops
game.ReplicatedStorage.AnimLoopedBE.Event:Connect(function(plr)
print("Looped")
if cs:HasTag(mouse.Target, "Node") then
offset = UDim2.new(offset.X.Scale,offset.X.Offset - (offset.X.Offset / mouse.Target.Hits.Value),offset.Y.Offset,offset.Y.Scale)
print(offset.X.Offset)
end
end)