I have created a script that takes a part and when z is pressed it is place don the head. However for some reason on online mode the weld that sticks it to the face ends up in nil space. Here is the script.

wait()
ObjStorage = game.ReplicatedStorage.ObjStorage
ContextActionService = game:GetService("ContextActionService")
plr = game.Players.LocalPlayer
char = plr.Character
hum = char.Humanoid
bool = true
function mask(ActionName, InputState, InputObj)
	if InputState == Enum.UserInputState.Begin then
		if bool then
			wait(.1)
			bool = false
			HatRemover(true)
			Balaclava(true)
		elseif not bool then
			wait(.1)
			bool = true
			Balaclava(false)
			HatRemover(false)

		end
	end
end
ContextActionService:BindAction("Mask",mask,false,Enum.KeyCode.Z)

function HatRemover(t)
	if t then
	for i,v in pairs(char:GetChildren()) do
		if v:IsA("Accessory") or v:IsA("Hat") then
			v.Parent = script
		end
	end
	elseif not t then
		for i,v in pairs(script:GetChildren()) do
			v.Parent = char
		end
	end
end
local boln = true
function Balaclava(t)
	if t and boln then
	boln = false
	m = ObjStorage.Balaclava:Clone()
	m.Parent = char
	m.Handle.Transparency = 0
	m.Handle.Anchored = false
	local weld = Instance.new("Weld", m.Handle)
	weld.C1 = CFrame.new(0, 0.600000024, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
	weld.C0 = CFrame.new(0, 0, -0.600000024, 1, 0, 0, 0, -4.37113883e-08, 1, 0, -1, -4.37113883e-08)
	weld.Part1 = char.Head
	weld.Part0 = weld.Parent
	wait(.5)
	print(weld.Parent)
	elseif not t and not boln then
		m:Destroy()
		boln = true
	end	
end

May anyone tell me why this may not be wokring on online mode?

1 comment

1

I also have a script that doesnt work in online mode but in studio mode it works..