Skip to content

Editing worldmodels on the fly? #7

@Vernoctus

Description

@Vernoctus

Hello! What I've been trying to do is create a single melee weapon model that can take on different appearances depending on what item a player has equipped in Pointshop 2. Right now, all I'm trying to do is allow them to choose between several colors of lightsaber, which will only require the skin to be edited.

It works fine for the person who is holding the saber, it always appears to be the right color in both first person and third person modes, but to anyone else who is looking at them it appears to be the default color that I specify.

    local Melee = self.Owner //Code removed here because you have to pay for it. It just 
                             //returns the name of the item in the player's "Melee" slot
    if Melee == nil then
        self.VElements["SaberY"].skin = 5 //The default skin, same as the starting one.
        self.WElements["SaberY"].skin = 5
    else
        if Melee == "Red Lightsaber" then
            self.VElements["SaberY"].skin = 4
            self.WElements["SaberY"].skin = 4
        elseif Melee == "Blue Lightsaber" then
            self.VElements["SaberY"].skin = 0
            self.WElements["SaberY"].skin = 0   
        elseif Melee == "Green Lightsaber" then
            self.VElements["SaberY"].skin = 1
            self.WElements["SaberY"].skin = 1       
        elseif Melee == "Purple Lightsaber" then
            self.VElements["SaberY"].skin = 3
            self.WElements["SaberY"].skin = 3
        end
    end

This is the code I have written to make it change skins, and as stated above it only works for the player actually holding the saber. It's located inside the SWEP:Think() function. I've thrown everything I can think of trying to get it to work, but I just can't get it. Any help you could provide would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions