Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to let a block stay infront of player?

hello beautiful people hope you are having a blessed day i'm making so if the thing is equipped the wall is in front if the player but it is always just next to the player can somebody please help

(ps. I want it to work on a model)

here is the script

script.Parent.Equipped:Connect(function()
	script.Parent.Value.Value = false
	wait(0.01)
	local building = game.Players.LocalPlayer.PlayerGui.building.Value
	local clone  = game.ReplicatedStorage[building]:Clone()
	clone.Parent = game.Workspace
	clone.Name = script.Parent.Parent.Name.."'s object"
	wait(0.01)
	repeat
		local x = script.Parent.Parent.HumanoidRootPart.Orientation.X
		local y = script.Parent.Parent.HumanoidRootPart.Orientation.Y
		local z = script.Parent.Parent.HumanoidRootPart.Orientation.Z
	clone.PrimaryPart.Position = Vector3.new(Vector3.new(0,0,5) + game.Players.LocalPlayer.Character.HumanoidRootPart.Position)
	clone:SetPrimaryPartCFrame(CFrame.Angles(x,y,z))
	    wait(0.1)
	until script.Parent.Value.Value == true

i have alot alot more script but that is the part i have it to follow the player...

help?

1 answer

I would weld it to the players HumanoidRootPart by doing something like this

local Weld = Instance.new("WeldConstraint",script.Parent.Parent.HumanoidRootPart)
script.Parent.Parent.HumanoidRootPart.CFrame = -- Replace with your modle
Modle.CFrame = HumanoidRootPart.CFrame +(script.Parent.CFrame.lookVector * .01)
Weld.Part0 = script.Parent.Parent.HumanoidRootPart
Weld.Part1 = -- Modle

Hope I helped!

1 comment

0

yes i don't know if it will work but at line 3 "script.Parent.CFrame.lookVector" what to you want to select with "script.Parent" because now it select the tool =/

This discussion is preserved as it was. New answers, comments, and votes are closed.