#Models not being placed and no ghost outline.

1 messages · Page 1 of 1 (latest)

eternal quail
#

I'm trying to make it so when the player holds the build tool, it would allow the player to choose a structure to place and be able to actually place it with a ghost outline visible before placement. I am also going to be needed help later on when I take a stab at creating the proper snap points for said buildings.

here's the problem, when I test out the script, it does not allow me to place any structures, nor can I see a ghost outline. What am I doing wrong?

#

I used print blah blah blah to ensure that the script was actually active, and it only does the "buildtool is active" one

#

this is the PlacementHandler script:

local placeEvent = ReplicatedStorage:WaitForChild("PlaceStructureEvent")

placeEvent.OnServerEvent:Connect(function(player, structureName, cframe)
    print("Received placement request from", player.Name, "for", structureName)
    
    local structuresFolder = ReplicatedStorage:FindFirstChild("Structures")
    if not structuresFolder then
        warn("Structures folder not found in ReplicatedStorage")
        return
    end
    
    local structure = structuresFolder:FindFirstChild(structureName)
    if not structure then
        warn("Structure not found:", structureName)
        return
    end
    
    local newStructure = structure:Clone()
    newStructure:PivotTo(cframe)
    newStructure:SetAttribute("IsStructure", true)
    newStructure:SetAttribute("PlacedBy", player.Name)
    newStructure.Parent = workspace
    
    print("Successfully placed", structureName, "at", cframe.Position)
end)```