#Why is my script not working

1 messages · Page 1 of 1 (latest)

stark anvil
#

local CharacterModule = require(game.ReplicatedStorage.CharacterModule)

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)

    local CharacterChosen = plr:GetAttribute("CharacterChosen")
    if not CharacterChosen then return end

    local Data = CharacterModule[CharacterChosen]
    if not Data then return end

    local Weapon = game.ReplicatedStorage:FindFirstChild(Data.Weapon)
    if Weapon then
        Weapon = Weapon:Clone()
        Weapon.Parent = char

        local hand = char:WaitForChild("RightHand")
        local weld = Instance.new("Motor6D")
        weld.Part0 = hand
        weld.Part1 = Weapon
        weld.C0 = CFrame.new(0,0,0)
        weld.C1 = CFrame.new(0,0,0)
        weld.Parent = hand

        print("Hello")-- this doesnt print btw

    end
end)

end)

#

also like the weapon doesnt get parented to char nor does the weld get parented to the hand

tulip sundial
#

does Data exist?

stark anvil
#

yes, no errors too

gloomy surge
# stark anvil yes, no errors too

check if characteradded is firing by adding a print statement directly under it

then if that works check print out what characterchosen is and data is and weapon is

stark anvil
#

ill try that

#

the print statement under characteradded doesnt fire at all

gloomy surge
#

right

#

under serverscriptservice

stark anvil
#

wait it wasnt in serverscriptservice

#

tysm, its fixed now