Hello! I am coming back to a weld script to fix it and I couldn't get what was wrong. The script shows no signs of anything working, and there are no errors in the output... It only works in a local script, but that would mean other players couldn't see it. I can't really explain this much further except its a sword that loads onto the player when they join if they are a specific character. It works in two scripts. One fires all the events, the other is one of them that loads the sword. Please help!
Here's the event fire (The "print()" works on this one):
--In StarterPack
--Local Script
wait(2)
local plr = game.Players.LocalPlayer
local class = plr.leaderstats.class
local event = game.ReplicatedStorage.ClassData.Bloxxer.BWeld
local event2 = game.ReplicatedStorage.ClassData.Bloxxer.BDelete
local b = script.Parent
if event then
print("ok")
end
if class.Value == 1 then
event:FireServer(plr)
print("1 les")
end
local function makeclass()
print("1 les")
event:FireServer(plr)
plr.PlayerGui.ClassMoves.MoveSet.Visible = true
print("2 les")
b.ATTACK.ATTACK.Disabled = false
end
local function endclass()
b.Attack.Disabled = true
event2:FireServer(plr)
print("ASD")
end
class.Changed:Connect(function(class)
if class == 1 then
makeclass()
if class ~= 1 then
endclass()
end
end
end)
And the weld script (The "print()" doesn't work on this one):
--In StarterCharacterScripts
--Server Script
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
print("bubububub")
local event = game.ReplicatedStorage.ClassData.Bloxxer.BWeld
local event2 = game.ReplicatedStorage.ClassData.Bloxxer.BDelete
local function Connected()
print("okok")
local part = game.ReplicatedStorage.ClassData.Bloxxer.BloxxerSword:Clone()
part.Name = "BSword"
local weld = Instance.new("Weld",part)
print("lets go lets og")
part.Parent = plr.char
weld.Anchored = false
weld.Massless = true
weld.Part0 = part
weld.Part1 = char["RightHand"]
weld.C0 = CFrame.new(-8, -1, -7) + Vector3.new(0,char["RightHand"].Size.Y/1,0)
weld.C0 = CFrame.Angles(0,math.rad(180), 140)
end
print(char)
print("okok")
local part = game.ReplicatedStorage.ClassData.Bloxxer.BloxxerSword:Clone()
part.Name = "BSword"
local weld = Instance.new("Weld",part)
print("lets go lets og")
part.Parent = char
part.Anchored = false
part.Massless = true
weld.Part0 = part --Attach to the handle
weld.Part1 = char:WaitForChild("RightHand") --Attach to the right hand.
weld.C0 = CFrame.new(-8, -1, -7) + Vector3.new(0,char["RightHand"].Size.Y/1,0)
weld.C0 = CFrame.Angles(0,math.rad(180), 140)
local function Connected2()
local part = char.BSword
part:BreakJoints()
part.Destroy()
end
event.OnServerEvent:Connect(Connected)
event2.OnServerEvent:Connect(Connected2)
end)
end)
Thanks.
