Mouse function for build script not working

Hi my script doesnt workin im want to call two function but its write this is errors

Here is script
local player = game.Players.LocalPlayer

local Wall = script.Parent.Wall

local Assets = script.Assets

local Mouse = player:GetMouse()

local posX,posY,posZ = Mouse.Hit.X,Mouse.Hit.Y,Mouse.Hit.Z

local BuildingNow = false

local What

script.Parent.PlanksFloor.HitBox.MouseButton1Down:Connect(function()

if BuildingNow == false then

Part = Assets.RusticPlanks:Clone()

Part.Parent = workspace

Part.Position = Vector3.new(posX,0.696,posZ)

Part.Orientation = script.Parent.Orientation.Value

Part.Transparency = 0.5

What = “FloorP”

BuildingNow = true

else

BuildingNow = false

print(player.Name…“Has Building”)

end

end)

script.Parent.Wall.HitBox.MouseButton1Down:Connect(function()

if BuildingNow == false then

Part = Assets.RusticPlanks:Clone()

Part.Parent = workspace

Part.Position = Vector3.new(posX,posY,posZ)

Part.Orientation = script.Parent.Orientation.Value

Part.Transparency = 0.5

What = “WallP”

BuildingNow = true

else

BuildingNow = false

print(player.Name…“Has Building”)

end

end)

Mouse.Move:Connect(UpdatePosition)

wait(0.1)

Mouse.Move:Connect(UpdatePosition2)

function UpdatePosition()

if BuildingNow == true and What == “WallP” then

local posX,posY,posZ = Mouse.Hit.X,Mouse.Hit.Y,Mouse.Hit.Z

Part.Orientation = script.Parent.Orientation.Value

Part.Position = Vector3.new(posX,5.073,posZ)

end

end

function UpdatePosition2()

if BuildingNow == true and What == “FloorP” then

local posX,posY,posZ = Mouse.Hit.X,Mouse.Hit.Y,Mouse.Hit.Z

Part.Orientation = script.Parent.Orientation.Value

Part.Position = Vector3.new(posX,0.696,posZ)

end

end

function BuildingDone()

if BuildingNow == true then

Part.Transparency = 0

Part.CanCollide = true

wait(0.1)

BuildingNow = false

end

end

Mouse.Button1Down:Connect(BuildingDone)

Thank for reading

Mouse.Move:Connect(UpdatePosition)
Mouse.Move:Connect(UpdatePosition2)

These two should be put after the UpdatePosition and UpdatePosition2 function declaration.

1 Like

Okey im try wait Thank for reply

1 Like

FYI: Be sure to use markdown to make the readability of your code easier on the DevForums.
Here’s how:
```
–Code here
```

FYI 2: Please be sure to do basic debugging in the future before posting threads. It is not proper use of this category to say that your code is not working and then dump your code in a thread and ask for fixes. Please review the category guidelines.

Always try fixing this yourself first, then you can post a thread with added detail. Don’t make a thread where you just say your code doesn’t work and then post everything on the thread.