stuff.rbxl (39.3 KB)
Basically, it’s a coin animation and there is one script that I would like to be improved: StarterPlayerScripts > Animation
local remote = game:GetService("ReplicatedStorage"):WaitForChild("AnimationEvent")
local player = game.Players.LocalPlayer
local pg = player:WaitForChild("PlayerGui")
local sui = pg:WaitForChild("Animation")
local zone = sui:WaitForChild("zone")
local frame = script:WaitForChild("frame")
local ts = game:GetService("TweenService")
function TweenTransparency(Thing, Time, Style, Direction, valueArg)
spawn(function()
local info = TweenInfo.new(Time, Style, Direction, 0, false, 0)
local newtween = ts:Create(Thing, info, {TextTransparency = valueArg})
newtween:Play()
wait(Time)
newtween:Destroy()
end)
end
local function animation(value, image_id, amount_of_images, textcolor, valuename, position)
local clone = frame:Clone()
local r1 = math.random(0, 750)
local r2 = math.random(0, 750)
local award = clone:WaitForChild("award"):WaitForChild("award")
local white = award:WaitForChild("white")
local shad = award:WaitForChild("shadow")
value = ("+"..value.." "..valuename)
award.Text = value
white.Text = value
shad.TextColor = BrickColor.new(textcolor.r/2.5, textcolor.g/2.5, textcolor.b/2.5)
award.TextColor = textcolor
shad.Text = value
clone.Position = UDim2.new(r1/1000, 0, r2/1000, 0)
for i = 1, amount_of_images do
local img = clone:WaitForChild("img"):Clone()
img.Image = "http://www.roblox.com/asset/?id="..image_id
local r1 = math.random(-9, 65)
local r2 = math.random(-1, 56)
local r3 = math.random(25, 34)
local r4 = math.random(25, 43)
img.Position = UDim2.new(r1/100, 0, r2/100, 0)
img.Size = UDim2.new(r3/100, 0, r4/100, 0)
img.Rotation = math.random(0, 180)
img.Parent = clone
img.Visible = true
end
clone.Parent = zone
clone:TweenSize(UDim2.new(0.435, 0, 0.355, 0), "Out", "Linear", 0.1, true)
wait(0.3)
award:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Linear", 0.2, true)
wait(0.4)
white:TweenSize(UDim2.new(1.75, 0, 1.75, 0), "Out", "Linear", 0.5, true)
TweenTransparency(white, 0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1)
wait(0.2)
for _, v in pairs(clone:GetChildren()) do
wait(0.05)
if v.Name == "img" then
v:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Linear", 0.5, true)
v:TweenPosition(position, "Out", "Linear", 0.5, true)
end
end
wait(0.5)
TweenTransparency(award, 0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1)
TweenTransparency(shad, 0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1)
wait(0.5)
clone:Destroy()
--warn(value, image_id, amount_of_images)
end
remote.OnClientEvent:Connect(animation)
This is pretty unorganized and if anyone can help me that would be amazing!
It’s a bit messy, and I think it can be improved.
Thanks,
recanman