I am making a gun script, the weld script works amazingly in studio but not in server heres the place to see server-wide http://www.roblox.com/Border-Conflict-place?id=180698731
Heres the script(note that it has a timer to let the character load)
it creates a local version for the player cause if it wasnt local it would look funky and it makes a server version thats invisibile to the player but visible to others so it looks normal
local player = game.Players.LocalPlayer player.CameraMode = "Classic" body = player.Character local cam = game.Workspace.CurrentCamera if cam:FindFirstChild("LocalBin") == nil then local bin = Instance.new("Message") bin.Name = "LocalBin" bin.Parent = cam end function onselect() bin = cam:FindFirstChild("LocalBin") weld = Instance.new("Weld") weld.Name = "RightArmWeld" weld.Part0 = body.Torso weld.Part1 = body["Right Arm"] weld.C1 = CFrame.new(-1.3,0,0) weld.Parent = weld.Part0 ---- package = "SR-33_WeldInfo" base = script.Parent.Handle model = Instance.new("Model") model.Name = "FakeGun" model.Parent = script.Parent.Handle if game.Lighting:FindFirstChild(package) ~= nil then bag = game.Lighting:FindFirstChild(package) bag2 = bag:GetChildren() for i = 1, #bag2 do items = bag2[i] cp = items:GetChildren() for i = 1, #cp do if cp[i].ClassName == "Part" or cp[i].ClassName == "Seat" then clone = cp[i]:Clone() clone.Anchored = false clone.CanCollide = false clone.Parent = model weld = Instance.new("Weld") weld.Part0 = base weld.Part1 = clone weld.C0 = items.C0.Value weld.C1 = items.C1.Value weld.Parent = base end end end end --Welds-- chicken = script.Parent.Handle.FakeGun:GetChildren() for i = 1, #chicken do wait() base = body["Right Arm"] bc = chicken[i] weld = Instance.new("Weld") weld.Part0 = bc weld.Part1 = base baseposition = bc.Position newbaseposition = CFrame.new(baseposition) C0 = bc.CFrame:inverse() *newbaseposition C1 = base.CFrame:inverse() *newbaseposition weld.C0 = C0 weld.C1 = C1 weld.Parent = bc end --Local Welds-- package = "SR-33_LocalWeld" base = script.Parent.Handle if game.Lighting:FindFirstChild(package) ~= nil then bag = game.Lighting:FindFirstChild(package) bag2 = bag:GetChildren() for i = 1, #bag2 do items = bag2[i] cp = items:GetChildren() for i = 1, #cp do if cp[i].ClassName == "Part" or cp[i].ClassName == "Seat" then local clone = cp[i]:Clone() clone.Anchored = false clone.CanCollide = false clone.Parent = bin local weld = Instance.new("Weld") weld.Part0 = clone weld.Part1 = base weld.C0 = items.C1.Value weld.C1 = items.C0.Value weld.Parent = clone end end end end script.Aim.Disabled = false end function ondeselect() script.Aim.Disabled = true a = cam:FindFirstChild("LocalBin"):GetChildren() for i = 1, #a do if a[i].ClassName == "Part" then a[i]:remove() end end for i, v in pairs(script.Parent:GetChildren()) do if v.Name ~= "Handle" and v.ClassName == "Part" then v:remove() end end end script.Parent.Equipped:connect(onselect) script.Parent.Unequipped:connect(ondeselect)