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

Everyone's startercharacter changes, but i just want my own to change?

Asked by 5 years ago
Edited 5 years ago

hello! i'm working on a game in which you can switch between different characters. my game does this by cloning different startercharacters (stored in starterpack) into the starterplayer and switching out the character currently being used.

This works just fine!! there's just one problem.

Say I have a base character (a colorless, featureless character) that everyone spawns in as before choosing which character to play as. If I choose, for example, to play as a cat, I respawn as a cat. The problem is.... everyone else who resets or joins the game from that point on will no longer spawn in as the base character, but rather the cat.

I'm using a remote event for the buttons that trigger switching to another starter character.

Here is my local script:

function Click() 

    game.ReplicatedStorage.RemoteEvent:FireServer()
    end

script.Parent.MouseButton1Down:connect(Click) 

and my server script:

local Beta = game.StarterPack.Beta 
local BetaClone = Beta:Clone()

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)


    game.StarterPlayer.StarterCharacter.Name= "NotInUse"
    BetaClone.Parent = game.StarterPlayer
    BetaClone.Name = "StarterCharacter"
    player:LoadCharacter()



    end)

(note: Beta is the name of one of my characters in the game.)

I realize the problem is that the remote event is causing everyone's startercharacter to change, not just one person's. But I'm not sure how to fix it. Does anyone know how to fix it to where only the local player's startercharacter will change, and not everyone else's? Or if there are better ways to make this work? I dont even know if remoteevents are required for this.

i'm a little new at remoteevents, so i probably sound kinda inexperienced, but can someone help? thank you!!

0
change the script to a local script (mic drop) DeceptiveCaster 3761 — 5y
0
Well, that's the problem. They can't both be local scripts, or else the remote event doesnt work. yoshikins101 11 — 5y

1 answer

Log in to vote
0
Answered by
Imperialy 149
5 years ago

use a localscript; and if you cant, just make a characteradded event and clone the localscript into that

0
Ah! really good idea!! i cant believe i didnt think of this before lol,, thank you lots!! yoshikins101 11 — 5y
Ad

Answer this question