Ok, my problem is that some of the images are not visible in the screen even when the visible property is true and the ImageTransparency property is 0, the textlabel has the same problem too, i modify this properties on the script but idk what is going on, and i want to make the image and textlabel appears on the screen with a random position on the frame but this works only once, when i click again appears in the same position without changing. I dont know if its a studio problem and sorry for my English.
Local Script
--[Important Variables]
local RS = game:GetService("ReplicatedStorage")
local TS = game:GetService("TweenService")
local GainStrengthEvent = RS.RemoteEvents.GainStrength
local player = game.Players.LocalPlayer
local WeightTool = script.Parent
local db = false
--[Animation Variables]
local StrengthAnimationEquip = script.Parent:WaitForChild("StrengthAnimationEquip", 0.5)
local StrengthAnimationActivate = script.Parent:WaitForChild("StrengthAnimationActivate", 0.5)
local AnimationTrackEquip
local AnimationTrackActivate
local humanoid
--[Gui Variables]
local StarterGui = game:GetService("StarterGui")
local GainStrengthGui = StarterGui.GainStrengthGui
local StrengthImage = GainStrengthGui.StrengthLabel.StrengthFrame.StrengthImageLabel
local StrengthLabel = StrengthImage.Parent.StrengthLabel
local StrenghtLabelStroke = StrengthLabel.UIStroke
local Tweeninfo = TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0)
local ImagePosition = UDim2.fromOffset(math.random(25, 572), math.random(25, 368))
local ImageLabelPosition = UDim2.fromOffset(ImagePosition.X.Offset + 20, ImagePosition.Y.Offset - 20)
local Tween = TS:Create(StrengthImage, Tweeninfo, {Position = ImagePosition})
local TweenLabel = TS:Create(StrengthLabel, Tweeninfo, {Position = ImageLabelPosition})
local Tweeninfo2 = TweenInfo.new(2, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0)
local ImageRotation = 360
local Tween2 = TS:Create(StrengthImage, Tweeninfo2, {Rotation = ImageRotation})
local Tweeninfo3 = TweenInfo.new(1.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 1)
local LabelSize = UDim2.new(0.15, 0, 0.1, 0)
local Tween3 = TS:Create(StrengthLabel, Tweeninfo3, {Size = LabelSize})
local Tweeninfo4 = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, true, 0)
local ImageTransparency1 = 1
local LabelTransparency = 1
local StrokeTransparency = 1
local Tween4 = TS:Create(StrengthImage, Tweeninfo4, {ImageTransparency = ImageTransparency1})
local Tween5 = TS:Create(StrengthLabel, Tweeninfo4, {TextTransparency = LabelTransparency})
local Tween6 = TS:Create(StrenghtLabelStroke, Tweeninfo4, {Transparency = StrokeTransparency})
WeightTool.Equipped:Connect(function(mouse)
local character = WeightTool.Parent or player.CharacterAdded:Wait()
if character then
humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
local AnimatorEquip = humanoid:FindFirstChildOfClass("Animator")
if AnimatorEquip then
AnimationTrackEquip = AnimatorEquip:LoadAnimation(StrengthAnimationEquip)
if AnimationTrackEquip then
AnimationTrackEquip:Play()
humanoid.UseJumpPower = true
humanoid.JumpPower = 0
humanoid.WalkSpeed = 0
return AnimationTrackEquip
end
end
end
end
end)
WeightTool.Activated:Connect(function()
local character = WeightTool.Parent or player.CharacterAdded:Wait()
if character then
humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
local AnimatorActivate = humanoid:FindFirstChildOfClass("Animator")
if AnimatorActivate then
AnimationTrackActivate = AnimatorActivate:LoadAnimation(StrengthAnimationActivate)
if AnimationTrackActivate then
if db == false then
db = true
AnimationTrackActivate:Play()
GainStrengthEvent:FireServer()
Tween:Play()
TweenLabel:Play()
Tween2:Play()
Tween3:Play()
Tween4:Play()
Tween5:Play()
Tween6:Play()
task.wait(1.15)
db = false
return AnimationTrackActivate
end
end
end
end
end
end)
local ImageTransparency2 = 0
local ImageRotation2 = 0
local Tweeninfo5 = TweenInfo.new(2, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0.5)
local Tween7 = TS:Create(StrengthImage, Tweeninfo5, {ImageTransparency = ImageTransparency2, Rotation = ImageRotation2})
Tween.Completed:Connect(function()
Tween7:Play()
end)
Basically, i’m trying to make a image label gets a random position on the frame when the player click with the Activate event of the tool and this will make animations like rotation, tweening, and the text label size will grow horizontally and so on.
Note: If you need more information then let me know, thanks!