i want to add animations for when the player buys a tycoon item like a dropper or upgrader or wall and so on
I made a animation function but dont know how to implement it
i tried using id but thats a string attribute in the button to determine which model to build so how do i get the model from the id?
local SuccessfullyBought = ReplicatedStorage.Remotes:WaitForChild("Bought")
function AnimateBuild(Model)
for _, v in pairs(Model:GetChildren()) do
if v:IsA("BasePart") then
local OriginalPosition = v.Position
local OriginalTransparency = v.Transparency
local PositionOffset = Vector3.new(-10, 10, 5) -- Adjust the Y value to control the upward movement distance
v.Position = OriginalPosition + PositionOffset
v.Transparency = 1
local tweenInfo1 = TweenInfo.new(.7, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out)
local tweenInfo2 = TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
TweenService:Create(v, tweenInfo1, {Position = OriginalPosition}):Play()
TweenService:Create(v, tweenInfo2, {Transparency = OriginalTransparency}):Play()
end
end
end
SuccessfullyBought.OnClientEvent:Connect(function(Model)
print("called")
AnimateBuild(Model)
end)
```lua
function Button:Press(player)
local id = self.Instance:GetAttribute("Id")
local cost = self.Instance:GetAttribute("Cost")
local money = PlayerManager.GetMoney(player)
if player == self.Tycoon.Owner and money >= cost then
PlayerManager.SetMoney(player, money - cost)
self.Tycoon:PublishTopic("Button", id)
--game:GetService("ReplicatedStorage").Remotes:WaitForChild("Bought"):FireClient(player, model)
end
end