Can't put a part into head

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    im trying to put a part into a players head to look like blood vomit when a player touches a part

  2. What is the issue? Include screenshots / videos if possible!
    it doesn’t do anything

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i’ve tried using instance.new, tried using :Clone but nothing works

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

	
	if Toucher.Parent.Humanoid then
		local player = game.Players:GetPlayerFromCharacter(Toucher)
		local gui = player.PlayerGui.InfectedWithAnthrax
		gui.Enabled = true
		local head = Toucher.Parent.Head
		local newPart = script.Blood:Clone()
		newPart.Parent = head
		newPart.Massless = true --You will likely want to set at least these properties
		newPart.CanCollide = false
		newPart.Anchored = false
		local weld = Instance.new("Weld", head) --Could also use a Motor6D, or likewise
		weld.C0 = CFrame.new() --Both C0 and C1 are, by default, set to a blank CFrame
		weld.C1 = CFrame.new()
		weld.Part0 = head
		weld.Part1 = newPart

			end
		end




script.Parent.Touched:Connect(Infect)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

You are setting the cframe to 0,0,0 don’t set C0 and C1.

still doesn’t work when i try it

it also says “attempt to index nil with playergui”

and it is a serverscript located inside a part

Change this to something like

local newPart = script.Blood:Clone()
newPart.CFrame = head.CFrame
newPart.Massless = true --You will likely want to set at least these properties
newPart.CanCollide = false
newPart.Anchored = false
newPart.Parent = head

local weld = Instance.new("WeldConstraint", head) --Could also use a Motor6D, or likewise
weld.Part0 = newPart
weld.Part1 = head

had to edit that forgot to drop the cframe part in

may need to move the parenting down below the weld can’t remember if roblox will weld without it being in workspace on the weldconstraint

i fixed it, i tried to find the char with the PART of the player that touched, not the model

1 Like