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

I have welding issues, can someone help?

local Player = game.Players.LocalPlayer

local NVGP = Instance.new("Part")
NVGP.Anchored = false
NVGP.Name = "NightVision"
NVGP.Parent = game.Workspace.CurrentCamera
NVGP.FormFactor = 3
NVGP.Size = Vector3.new(.2,.2,.2)
NVGP.Transparency = 1
NVGP.CanCollide = false
NVGP.CFrame = script.Parent.Head.CFrame
NVGP.BackSurface = "Smooth"
NVGP.BottomSurface = "Smooth"
NVGP.FrontSurface = "Smooth"
NVGP.LeftSurface = "Smooth"
NVGP.RightSurface = "Smooth"
NVGP.TopSurface = "Smooth"

local Light1 = Instance.new("PointLight")
Light1.Parent = NVGP
Light1.Enabled = false
Light1.Brightness = 100000
Light1.Range = 60
Light1.Color = Color3.new(0,255,0)

local Light2 = Instance.new("SpotLight")
Light2.Parent = NVGP
Light2.Enabled = false
Light2.Brightness = 100000
Light2.Range = 60
Light2.Color = Color3.new(0,255,0)

local Weld = Instance.new("Weld", NVGP)
Weld.Part0 = NVGP
Weld.Part1 = Player.Character.Head

this script is placed inside the character, it works, however when part NVGP is welded to the player's head, the player is frozen and is unable to move, any idea how to fix this?

1 answer

This is actually a very particular problem. When you set the Parent on line 6, you later set the Size on line 8. Doing this actually causes the part to make joints with the BasePlate.

You can wait to set the parent until after you make the actual weld, or just after you set all of the other properties.

Also, Color3 does not take 0-255 values: it takes 0-1 values, so divide by 255 or just write 1.

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