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