This is a cut script from my shop GUI, cuz i don't want to post long scripts here, also people from stealing it..
At line 10, line 16, line 23 i'm trying to set where the player's mouse is make text appear once he clicks.
Printing shows up in the output, but the text doesn't work at all if i remove the UDim2.new(0, mouse.X, 0, mouse.Y) lines for all of them it will work but thats not what i want.
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
function BuyArmor(armor, price)
if Player.UnlockedArmor:FindFirstChild(armor).Value == false then
if Player.leaderstats.Gold.Value >= price then
Player.leaderstats.Gold.Value = Player.leaderstats.Gold.Value - price
Player.UnlockedArmor:FindFirstChild(armor).Value = true
print("bought")
bought.Position = UDim2.new(0, mouse.X, 0, mouse.Y) -- <
bought.Visible = true
wait(1.5)
bought.Visible = false
else
print("not enough")
notenough.Position = UDim2.new(0, mouse.X, 0, mouse.Y) -- <
notenough.Visible = true
wait(1.5)
notenough.Visible = false
end
else
print("already got armor")
alreadyhave.Position = UDim2.new(0, mouse.X, 0, mouse.Y) -- <
alreadyhave.Visible = true
wait(1.5)
alreadyhave.Visible = false
end
end
for i = 1, #buttons do
GUI.Hold.Frame1:FindFirstChild(buttons[i]).MouseButton1Click:connect(function() BuyArmor(armorVarNames[i], prices[i])end)
