Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Assigning one RemoteEvent to a change shirt script which has multiple functions?

Asked by 4 years ago

RemoteEvents to change this models shirt? I was told to only use one event for all the shirts but I heard that using it for EACH and EVERY shirt in the game would ofc slow it down and I made a table containing these shirts but its rather confusing because the event can only take this one command for Shirt[1] will I have to make an event for each shirt I make in the game?

Name: LocalScript, inside all textbuttons in StarterGui, I want each TextButton to display a different shirt when its pressed

local part = script.Parent
part.MouseButton1Click:Connect(function()
    local ReplicatedS = game.ReplicatedStorage
    ReplicatedS.ShirtEvent:FireServer()
    if true then 
        print("Server has been fired")
    end

end)

Name: ShirtChangeScript, inside ServerScriptService

BlackLongS = "rbxassetid://2787443933"
PurpleTw = "rbxassetid://1011563561"

ShirtsTable = {BlackLongS, PurpleTw }


game.ReplicatedStorage.ShirtEvent.OnServerEvent:Connect(function(char)
     char = game.Workspace.Model.StarterCharacter
    if char then
        print("Character found")

        char.RedShirt1.ShirtTemplate = ShirtsTable[1]
    end 
end)

--How would I do this for ShirtsTable[2]?

Side note: Whenever I start server and have 2 players on, I want only one player to see what they changed to the model since its their custom character. However whenever player1 selects the button to change the shirt player2 see's these changes even though I used a local script?

Answer this question