Why isn't this taking the Model inside of the Part? [Solved]
Asked by
7 years ago Edited 7 years ago
http://prntscr.com/gwrfn8
Problem: Not copying the Bed Model inside of it
Errors: None
02 | Player = game.Players.LocalPlayer |
03 | mouse = Player:GetMouse() |
05 | ScreenGui = script.Parent |
06 | Purchase = ScreenGui:WaitForChild( "Place" ) |
12 | Turrets = game.ReplicatedStorage:WaitForChild( "Turrets" ) |
13 | BaseTurret = Turrets:WaitForChild( "Turret01" ) |
17 | mouse.Button 1 Down:connect( function () |
18 | if InPlaceMode = = true and CanPlace = = true then |
20 | if NewTurret and NewTurret:FindFirstChild( "SelectionBox" ) then |
21 | NewTurret:FindFirstChild( "SelectionBox" ):Destroy() |
22 | for i,v in pairs (NewTurret:GetChildren()) do |
23 | if v:IsA( "BasePart" ) then |
31 | Purchase.MouseButton 1 Down:Connect( function () |
32 | if not InPlaceMode then |
34 | NewTurret = BaseTurret:Clone() |
35 | NewTurret.Parent = game.Workspace |
36 | local SelectionBox = Instance.new( "SelectionBox" ,NewTurret) |
37 | SelectionBox.Color 3 = Color 3. new( 0 / 255 , 255 / 255 , 0 / 255 ) |
38 | SelectionBox.Adornee = NewTurret |
39 | mouse.TargetFilter = NewTurret |
43 | local Hit = mouse.Hit.p |
44 | local X 0 , Y 0 , Z 0 = Hit.X - math.fmod(Hit.X, 4 ), Hit.Y - math.fmod(Hit.Y, 1 ), Hit.Z - math.fmod(Hit.Z, 4 ) |
45 | if mouse.Target and mouse.Target.Name = = "BuildSpace" then |
46 | NewTurret.Position = (Vector 3. new(X 0 ,Y 0 ,Z 0 )) |
47 | SelectionBox.Color 3 = Color 3. new( 0 / 255 , 255 / 255 , 0 / 255 ) |
48 | SelectionBox.Adornee = NewTurret |
50 | for i,v in pairs (NewTurret:GetChildren()) do |
51 | if v:IsA( "BasePart" ) then |
55 | elseif mouse.Target then |
58 | SelectionBox.Color 3 = Color 3. new( 255 / 255 , 71 / 255 , 74 / 255 ) |
59 | for i,v in pairs (NewTurret:GetChildren()) do |
60 | if v:IsA( "BasePart" ) then |
63 | SelectionBox.Adornee = nil |