Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Block in my block placement system is cloning when it's not supposed to. Why?

Asked by 2 years ago

I have currently followed TheDevKing's tutorial of the block placement.

https://www.youtube.com/watch?v=hEqdq9VXfT4

The problem is, whenever I attempt to place this block, it always clones. Why?

I may show you my scripts.

StarterGui > MainGui > StructureHandler (LocalScript)

01local ReplicatedStorage = game:GetService("ReplicatedStorage")
02local PlacteStructure = ReplicatedStorage:WaitForChild("PlaceStructure")
03local Structures = ReplicatedStorage:WaitForChild("Structures")
04 
05local UIS = game:GetService("UserInputService")
06local RunService = game:GetService("RunService")
07 
08local player = game.Players.LocalPlayer
09local StructureFrame = script.Parent.StructureFrame
10local char = player.Character or player.CharacterAdded:Wait()
11local HumanoidRootPart = char:WaitForChild("HumanoidRootPart")
12 
13local mouse = player:GetMouse()
14 
15local yBuildingOffset = 1
View all 98 lines...

ServerScriptService > RemoteHandler (ServerScript)

01local ReplicatedStorage = game:GetService("ReplicatedStorage")
02local PlacteStructure = ReplicatedStorage:WaitForChild("PlaceStructure")
03local Structures = ReplicatedStorage:WaitForChild("Structures")
04 
05PlacteStructure.OnServerInvoke = function(player, StructureName, StructureCFrame)
06    local crafted
07    local realStructure = Structures:FindFirstChild(StructureName):Clone()
08 
09    if realStructure then
10        realStructure.CFrame = StructureCFrame
11        realStructure.Parent = workspace
12        crafted = true
13    else
14        crafted = false
15    end
16 
17    return crafted
18end

Answer this question