Basically im trying to make a tutorial for my game ive got some of it covered but im trying to make arrows pointing to a npc named "Master Baker" and im trying to get a script to place one end of the beam into the character and the other to the npc and here is the script ive got:
local EVENT = game.ReplicatedStorage.Tutorial EVENT.OnServerEvent:Connect(function() game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connected(function(char) local ATT1 = game.ReplicatedStorage:WaitForChild("TUTP") --a model which contains attachment0 ATT1.Parent = plr.char:WaitForChild('LowerTorso') -- im trying to place the model into the torso ATT1.CFrame = char:WaitForChild('LowerTorso').CFrame local Weld = Instance.new('ManualWeld') Weld.Part0 = ATT1 Weld.Part1 = char:WaitForChild('LowerTorso') Weld.C0 = ATT1.CFrame:inverse() * char:WaitForChild('LowerTorso').CFrame Weld.Parent = char:WaitForChild('LowerTorso') local beam = game.ReplicatedStorage.Beam:Clone() beam.Parent = plr.char:WaitForChild('LowerTorso') beam.Attachment1 = ATT1.Attachment0 end) end) end)
after all this i got nothing, not even a warning or error so is there a way this can be fixed or am i missing a step which i forgot like giving a position to where the beam has to be placed?
(also wanted to point out that i attachment1 is placed in the torso of the npc Master Baker.)
local attachment = Instance.new("Attachment")
Beams are only visible if it has a start point (attachment0), and an end point (attachment1). If you're wanting to add a beam to anything mid-way through a game, you'll need to create attachments,
local attachment0 = Instance.new("Attachment") attachment0.Parent = --Start part local attachment1 = Instance.new("Attachment") attachment1.Parent = --End part local beam = Instance.new("Beam") beam.Parent = --It's best to make the beam's parent the same as the attachment0's parent, just to keep things organized. beam.Attachment0 = attachment0 beam.Attachment1 = attachment1
This would create a basic, default beam, if you wish to use a special beam, change the line;
local beam = Instance.new("Beam")
to something like;
local beam = game.ReplicatedStorage.Beam:Clone()
Hope this helps!