Why my hat giver in GUI works only in local (only this player can see this hat)?
Hello, I have script in GUI which giving hat but only person which clicks this button can see this hat. Also script is in local script.
this is this script
01 | local player = game:GetService( "Players" ).LocalPlayer |
03 | script.Parent.MouseButton 1 Click:connect( function () |
04 | if player.Character:findFirstChild( "Humanoid" ) ~ = nil and player.Character:findFirstChild( "Head6" ) = = nil then |
05 | local g = game.ReplicatedStorage.Berets.ZANDARMERIA.Head 6 :clone() |
06 | g.Parent = player.Character |
07 | local C = g:GetChildren() |
09 | if C [ i ] .className = = "Part" or C [ i ] .className = = "UnionOperation" then |
10 | local W = Instance.new( "Weld" ) |
13 | local CJ = CFrame.new(g.Middle.Position) |
14 | local C 0 = g.Middle.CFrame:inverse()*CJ |
15 | local C 1 = C [ i ] .CFrame:inverse()*CJ |
20 | local Y = Instance.new( "Weld" ) |
21 | Y.Part 0 = player.Character [ "Head" ] |
23 | Y.C 0 = CFrame.new( 0 , 0 , 0 ) |
27 | local h = g:GetChildren() |
30 | h [ i ] .CanCollide = false |
32 | elseif player.Character:findFirstChild( "Humanoid" ) ~ = nil and player.Character:findFirstChild( "Head6" ) then |
33 | player.Character.Head 6 :remove() |