Hi, I'm attempting to create a build preview. Many of you probably know what I'm talking about but just in case let me explain. This script is supposed to check and see if the player has enough resources to build the wall, then if they do, take away the required resources and place a transparent version of the wall that follows your mouse until you click to place it again. I have finally gotten it to follow the players mouse now but when you click it doesn't place it down. Clicking does nothing it just continues to follow the mouse. Can someone please help me?
GUI = script.Parent.Parent.Parent.Parent
Wall = game.ServerStorage.WoodWall
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
script.Parent.MouseButton1Down:connect(function()
if Player.leaderstats.Wood.Value >= 5 then
Player.leaderstats.Wood.Value = Player.leaderstats.Wood.Value -5
GUI.Visible = false
WWall = Wall:Clone()
WWall.Parent = game.Workspace
WWall.Transparency = .5
end
end)
Mouse.Move:connect(function()
WWall.CFrame = CFrame.new(Mouse.Hit.p.x,1,Mouse.Hit.p.z)
Mouse.MouseButton1Down:Connect(function()
WWall.Position = Mouse.Hit.p
end)
end)

2 comments
you are not defining a mouse click for the placing. you have the placing script in the shop gui or whatever script.Parent is, it seems, if thats not it, then you dont have a script to place it
Okay, I've edited the code above and it still doesn't place.