New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help.
Log in to vote

Getting A Model To Follow A Player?

Asked by
Donut792 198
10 days ago

alright so i was trying to create myself a simple system to place a shack down and i got it to be able to place where the player is at but im wanting it to be relitively close to the player but in front of the player but what i am getting right now is the model placing on the player and keep in mind this game is going to be in first person so you can imagine how bad that is

anyways here is what i got for it so far Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
-- note to self make sure tool is not requires handle
local Tool = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Mouse = Player:GetMouse()
local Shack = ReplicatedStorage:FindFirstChild("Shack")
local debounce = false
        local ShackClone = Shack:Clone()
        ShackClone.Parent = workspace
        ShackClone.Name = "ShackBluePrint"
--      while true do
--          if debounce == false then
--              debounce = true
                ShackClone:SetPrimaryPartCFrame(,HumanoidRootPart.CFrame.lookVector * 100)
--              wait(2)
--              debounce = false


    local PositionClicked = Mouse.hit.p
    if Mouse.Target.Name == "Shack" then
    local posX, posY, posZ = PositionClicked.X, PositionClicked.Y, PositionClicked.Z
    game.ReplicatedStorage.PlaceFabrication:FireServer(posX, posY, posZ)

all the comments were an attempt to get it to follow the player but always resulted in script timeouts no matter how many different ways i set it up

Either use endered step or while loop not both. Make sure to have a wait(). royaltoe 2543 — 9d
Also add an offset BlackOrange3343 2653 — 9d

Answer this question