![]() ![]() ![]() Local rotation = CFrame.Angles(math.rad(0), math.rad(0), math.rad(90)) - Z to 90 bcs then the tree lies on the ground If target = Mouse.Target and target.Name = "Terrain" thenĬlickEventDown = Mouse.Button1Down:Connect(button1Down)ĬlickEventUp = Mouse.Button1Up:Connect(button1Up) SpawnedTree:PivotTo(position * rotation) - Transform Local rotation = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) - Set rotation (does'nt work) SpawnedTree.Parent = workspace - Add to workspace Local SpawnedTree = treeToSpawn:Clone() - Clone Tree Local randomInt = math.random(1, #children) If #children = 1 then - If there is only one model, select '1' "No trees found! They need to be in ReplicatedStorage/Trees") ![]() If #children = 0 then - If 'Trees' folder exist, check if there is tree models Local children = storage.Trees:GetChildren() "No 'Trees' folder found! Create this folder in ReplicatedStorage and place trees there!") If not storage:FindFirstChild("Trees") then - Just check if 'Trees' folder exist ![]() Local storage = game:GetService("ReplicatedStorage") - Obvious Local randomInt - Number of model to pick Local treeToSpawn = nil - Final Tree Model to spawn Local NO_TREES_FOLDER_FOUND_ERROR = "No 'Trees' folder found!" Local rotation = CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))ĪND! I use a tree model named Pine Tree - Pivot is in right place, Orientation and Position is set to (0, 0, 0)Įntire script (not localscript) located in workspace without GUI code: local NO_TREES_FOUND_ERROR = "No trees found!"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |