How to make an object go to a gui?

And this:

Image.Size = UDim.fromScale(workspace.Currency.Size.X, workspace.Currency.Size.Y)

Edit: You shouldn’t try to do this. It is easier to always use a certain number for the size of the currency than trying to figure it out with a code. If the currency is always 12 Studs X and 5 Studs Y long, then it’s better to play around with the Guis to get a good size as try to figure it out with a code.

Do you know how to make it hover and then go upward like the post did

2 Likes

What’s rotating? The gui/frame or the part?

I apologize, I corrected my post as i messed up on what I said.

2 Likes

Did I help you Or i not help you?

You helped a lot, im just curious how to make it go upward like the post did

Tween it.

local TweenService = game:GetService("TweenService")
local Tween = TweenService:Create(currencyPickup, TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), { currencyPickup.Position = currencyLabel.Position })

I’m aware there’s a function for Gui elements, but this is far more versatile.

What is “currencyPickup”? Is this the “Part” just renamed?

No, it’s the element you create when you pick up the currency.

I am quiet confused, element? I am new to vector/tweening all that.

Sorry, I’m using UI design terms. Basically an element is an imagelabel or textbutton. That kind of thing.

Ahh, I named that “Image” so would I just replace it? Also the currencyPickup.Position is getting errored?

That is also that “image” variable. The currencylabel is that imagelabel for the currency. You should’t have a problem if you tween it to there.

Am I doing this right???

local TweenService = game:GetService("TweenService")

local Tween = TweenService:Create(Image, TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), { Image.Position = player.PlayerGui.Profile.Frame.Cash.Position })

end)

This is my full code if needed

local player = game.Players.LocalPlayer

local RE = game.ReplicatedStorage:WaitForChild("Send")

RE.OnClientEvent:Connect(function()

print("received")

local camera = workspace.CurrentCamera

local worldPoint = workspace.Part.Position

local Vector = camera:WorldToScreenPoint(worldPoint)

--locel Depth = Vector.Z

local screenPoint = UDim2.fromOffset(Vector.X, Vector.Y)

local ScreenGui = Instance.new("ScreenGui", player.PlayerGui)

local Gui = Instance.new("Frame", ScreenGui)

local Image = Instance.new("ImageLabel", Gui)

--local vectorp = screenPoint.Position

Gui.BackgroundTransparency = 1

Gui.Size = UDim2.new(0.086, 1, 0.061, 1)

Image.Size = UDim2.new(0.675, 0, 1, 0)

Image.Image = "http://www.roblox.com/asset/?id=8057767"

Gui.AnchorPoint = Vector2.new(0.5, 0.5)

Gui.Position = screenPoint

Image.Position = 1,0,0,0

local TweenService = game:GetService("TweenService")

local Tween = TweenService:Create(Image, TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), { Image.Position = player.PlayerGui.Profile.Frame.Cash.Position })

end)
2 Likes

Seems right, not sure what’s wrong. Mind telling me the error?

I’ve realized what’s wrong! You forgot to play it!

Tween:Play()

Also, if you want the element to disappear then you could do this:

Tween.Completed:Connect(function()
-- no tabs because mobile
image:Destroy()
end)
2 Likes

I have this right now, and its giving me an error saying “unable to cast a dictionary”

local player = game.Players.LocalPlayer

local RE = game.ReplicatedStorage:WaitForChild("Send")

RE.OnClientEvent:Connect(function()

print("received")

local camera = workspace.CurrentCamera

local worldPoint = workspace.Part.Position

local Vector = camera:WorldToScreenPoint(worldPoint)

--locel Depth = Vector.Z

local screenPoint = UDim2.fromOffset(Vector.X, Vector.Y)

local ScreenGui = Instance.new("ScreenGui", player.PlayerGui)

local Gui = Instance.new("Frame", ScreenGui)

local Image = Instance.new("ImageLabel", Gui)

--local vectorp = screenPoint.Position

Gui.BackgroundTransparency = 1

Gui.Size = UDim2.new(0.086, 1, 0.061, 1)

Image.Size = UDim2.new(0.675, 0, 1, 0)

Image.Image = "http://www.roblox.com/asset/?id=8057767"

Gui.AnchorPoint = Vector2.new(0.5, 0.5)

Gui.Position = screenPoint

local TweenService = game:GetService("TweenService")

local Tween = TweenService:Create(Image, TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), { Image:TweenPosition(player.PlayerGui.Profile.Frame.Cash.Position) })

end)

Don’t do that.

Do this:

local Tween = TweenService:Create(Image, TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), { Image.Position = player.PlayerGui.Profile.Frame.Cash.Position })
Tween:Play()
Tween.Completed:Connect(function()
-- no tabs because mobile
image:Destroy()
end)