local cost = 10 -- cost of supply local plr = game.Players.LocalPlayer local item = plr:WaitForChild("Wood") local storage = game:GetService("ReplicatedStorage") --storage local mouse = plr:GetMouse() script.Parent.MouseButton1Click:connect(function(buy) local crafteditem = storage.Supplies:WaitForChild("Hut1"):clone() -- Item to buy if item then wait(1) if item.Value >= cost then if plr.PlayerGui.ihave.Frame.Crafting.Visible == true then plr.PlayerGui.ihave.Frame.Crafting.Visible = false end mouse.TargetFilter = crafteditem item.Value = item.Value - cost crafteditem.Parent = workspace for i,v in pairs (crafteditem:GetChildren()) do v.Transparency = .5 v.CanCollide = false end repeat wait() crafteditem:SetPrimaryPartCFrame(CFrame.new(mouse.hit.p)) until mouse.Button1Down if mouse.Button1Down then local copy = storage.Supplies.Hut1:clone() copy.Parent = workspace copy:SetPrimaryPartCFrame(CFrame.new(mouse.hit.p)) crafteditem:destroy() end end end end)
--The problem is is that its not waiting until the mouse button is clicked it just does it instantly after buying, its not letting the player place it.. .what do i do?