Alright so i tried the top one, and it only moved the position once (when the mouse first entered the gui)
The second one for some reason doesnt move the postion whatsoever,
also dont really know whats happening here but no matter what i do
Heres the script when for when i was trying the first one (edit, no longer moves it aswell for some reason)
local player = game.Players.LocalPlayer
local hoverinv = script.Parent.Parent.Parent.HoverInfo
local mouse = player:GetMouse()
local K = script.Parent
K.MouseEnter:Connect(function()
hoverinv.Visible = true
repeat
hoverinv.Position = UDim2.new(mouse.X, 0, mouse.Y, 0)
task.wait()
until K.MouseLeave
end)
K.MouseLeave:Connect(function()
hoverinv.Visible = false
end)
And heres the second one
local player = game.Players.LocalPlayer
local hoverinv = script.Parent.Parent.Parent.HoverInfo
local mouse = player:GetMouse()
local connection
local K = script.Parent
K.MouseEnter:Connect(function()
hoverinv.Visible = true
connection = mouse.Move:Connect(function()
hoverinv.Position = UDim2.new(mouse.X, 0, mouse.Y, 0)
end)
end)
K.MouseLeave:Connect(function()
hoverinv.Visible = false
if (connection) then
connection:Disconnect()
end
end)
local frame = script.Parent:WaitForChild("Frame")
local textButton = script.Parent:WaitForChild("TextButton")
local mouse = game.Players.LocalPlayer:GetMouse()
frame:SetAttribute("AmountSelectedBy",0)
for index,item in pairs(script.Parent:WaitForChild("ScrollingFrame"):GetChildren()) do
if (item:IsA("TextButton")) then
item.MouseEnter:Connect(function()
frame.Visible = true
frame:SetAttribute("AmountSelectedBy",frame:GetAttribute("AmountSelectedBy")+1)
end)
item.MouseLeave:Connect(function()
frame:SetAttribute("AmountSelectedBy",frame:GetAttribute("AmountSelectedBy")-1)
if (frame:GetAttribute("AmountSelectedBy") == 0) then
frame.Visible = false
end
end)
end
end
mouse.Move:Connect(function()
frame.Position = UDim2.new(0,mouse.X,0,mouse.Y)
end)
ill try it out in a bit, although is there a way to get the code to work in this function
for i, v in ipairs(CurrentInv) do
local K = C:Clone()
K.Text = v.Name
K.Visible = true
K.Parent = C.Parent
K.MouseButton1Click:Connect(function()
equipitem(v)
K:Destroy()
end)
K.MouseEnter:Connect(function()
connection = mouse.Move:Connect(function()
hoverinv.Position = UDim2.new(0,mouse.X,0,mouse.Y)
end)
end)
K.MouseLeave:Connect(function()
hoverinv.Visible = false
if (connection) then
connection:Disconnect()
end
end)
end
i tried pasting it over, and it doesnt really work
local player = game.Players.LocalPlayer
local inv = game.ReplicatedStorage.PlayerInvetorys:WaitForChild(player.Name .. "Folder")
local CurrentInv = inv:GetChildren()
local C = script.Parent.ItemFrame
local hoverinv = script.Parent.Parent.HoverInfo
local mouse = player:GetMouse()
local connection
print(CurrentInv)
function equipitem(item)
if not item then warn("Wheres My Gun At?") return end
game.ReplicatedStorage.TotallyCoolEvents.EquipGun:FireServer(item)
end
for i, v in ipairs(CurrentInv) do
local K = C:Clone()
K.Text = v.Name
K.Visible = true
K.Parent = C.Parent
K.MouseButton1Click:Connect(function()
equipitem(v)
K:Destroy()
end)
K.MouseEnter:Connect(function()
connection = mouse.Move:Connect(function()
hoverinv.Position = UDim2.new(0,mouse.X,0,mouse.Y)
end)
end)
K.MouseLeave:Connect(function()
hoverinv.Visible = false
if (connection) then
connection:Disconnect()
end
end)
end
inv.ChildAdded:Connect(function(Child)
local K = C:Clone()
K.Text = Child.Name
K.Visible = true
K.Parent = C.Parent
K.MouseButton1Click:Connect(function()
equipitem(Child)
K:Destroy()
end)
end)
local player = game.Players.LocalPlayer
local inv = game.ReplicatedStorage.PlayerInvetorys:WaitForChild(player.Name .. "Folder")
local CurrentInv = inv:GetChildren()
local C = script.Parent.ItemFrame
local hoverinv = script.Parent.Parent.HoverInfo
local mouse = player:GetMouse()
print(CurrentInv)
hoverinv:SetAttribute("AmountSelectedBy",0)
function equipitem(item)
if not item then warn("Wheres My Gun At?") return end
game.ReplicatedStorage.TotallyCoolEvents.EquipGun:FireServer(item)
end
for i, v in ipairs(CurrentInv) do
local K = C:Clone()
K.Text = v.Name
K.Visible = true
K.Parent = C.Parent
K.MouseButton1Click:Connect(function()
equipitem(v)
K:Destroy()
end)
K.MouseEnter:Connect(function()
hoverinv.Visible = true
hoverinv:SetAttribute("AmountSelectedBy",hoverinv:GetAttribute("AmountSelectedBy")+1)
end)
K.MouseLeave:Connect(function()
hoverinv:SetAttribute("AmountSelectedBy",hoverinv:GetAttribute("AmountSelectedBy")-1)
if (hoverinv:GetAttribute("AmountSelectedBy") == 0) then
hoverinv.Visible = false
end
end)
end
inv.ChildAdded:Connect(function(Child)
local K = C:Clone()
K.Text = Child.Name
K.Visible = true
K.Parent = C.Parent
K.MouseButton1Click:Connect(function()
equipitem(Child)
K:Destroy()
end)
end)
mouse.Move:Connect(function()
hoverinv.Position = UDim2.new(0,mouse.X,0,mouse.Y)
end)
local player = game.Players.LocalPlayer
local inv = game.ReplicatedStorage.PlayerInvetorys:WaitForChild(player.Name .. "Folder")
local CurrentInv = inv:GetChildren()
local C = script.Parent.ItemFrame
local hoverinv = script.Parent.Parent.HoverInfo
local mouse = player:GetMouse()
print(CurrentInv)
hoverinv:SetAttribute("AmountSelectedBy",0)
function equipitem(item)
if not item then warn("Wheres My Gun At?") return end
game.ReplicatedStorage.TotallyCoolEvents.EquipGun:FireServer(item)
end
for i, v in ipairs(CurrentInv) do
local K = C:Clone()
K.Text = v.Name
K.Visible = true
K.Parent = C.Parent
K.MouseButton1Click:Connect(function()
equipitem(v)
K:Destroy()
end)
K.MouseEnter:Connect(function()
hoverinv.Visible = true
hoverinv:SetAttribute("AmountSelectedBy",hoverinv:GetAttribute("AmountSelectedBy")+1)
end)
K.MouseLeave:Connect(function()
hoverinv:SetAttribute("AmountSelectedBy",hoverinv:GetAttribute("AmountSelectedBy")-1)
if (hoverinv:GetAttribute("AmountSelectedBy") == 0) then
hoverinv.Visible = false
end
end)
end
inv.ChildAdded:Connect(function(Child)
local K = C:Clone()
K.Text = Child.Name
K.Visible = true
K.Parent = C.Parent
K.MouseButton1Click:Connect(function()
equipitem(Child)
K:Destroy()
end)
K.MouseEnter:Connect(function()
hoverinv.Visible = true
hoverinv:SetAttribute("AmountSelectedBy",hoverinv:GetAttribute("AmountSelectedBy")+1)
end)
K.MouseLeave:Connect(function()
hoverinv:SetAttribute("AmountSelectedBy",hoverinv:GetAttribute("AmountSelectedBy")-1)
if (hoverinv:GetAttribute("AmountSelectedBy") == 0) then
hoverinv.Visible = false
end
end)
end)
mouse.Move:Connect(function()
hoverinv.Position = UDim2.new(0,mouse.X,0,mouse.Y)
end)