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

Does anyone know why this building script to place pieces and build results in errors?

Asked by 4 years ago

It results in an error with position, repeated no matter what and the second error if I rotated it before hand.

Errors at Line 85 and 93. 85: Attempt to index nil with position 93: Model:SetPrimaryCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this.

The errors only happen after it runs once. It's like it needs to update and realize that stuff doesn't exist. I don't really know.

Also there is another script, but it works fine.

001local replicatedStorage = game:GetService("ReplicatedStorage")
002local placeStructure = replicatedStorage:WaitForChild("PlaceStructure")
003local structures = replicatedStorage:WaitForChild("Structures")
004local sillhouettes = replicatedStorage:WaitForChild("Sillhouettes")
005 
006local UIS = game:GetService("UserInputService")
007local RunService = game:GetService("RunService")
008 
009--local player = game.Player.LocalPlayer
010local player = game:GetService("Players").LocalPlayer
011local StructureFrame = script.Parent
012local char = player.Character or player.Character:Wait()
013local HumanoidRootPart = char:WaitForChild("HumanoidRootPart")
014local mouse = player:GetMouse()
015local yBuildingOffset = 0.5
View all 129 lines...

I know this is a really long script and I'm sorry I just didn't know where else to look. If you read this all and find an answer then I really don't know how to thank you.

Answer this question