#Trouble Morphing a Specific Player

1 messages · Page 1 of 1 (latest)

livid cedar
#

Hey, working on a small survivor v killer game to learn scripting and need to write a script to morph a single selected player (whose username stored in an ObjectValue called chosen) into a different rig I've created. I've already written the code to select a player, but I can't figure out how to actually morph the player into the rig/model. (Which is just a modified but largely default R15 model) I've tried multiple tutorials on how to make physical and GUI-based morphs, but I can't figure out how to get it to work for my use-case. Does anyone have any suggestions?

kind drift
#

you do need a remoteevent named CharacterEvent in ReplicatedStorage though

#

you just fire this in your gui replace character name with your character and put this into a button click script

livid cedar
#

was animating lol

livid cedar
kind drift
#

put in servicescriptservice btw

livid cedar
#

ofc, thanks for clarifying tho

#

testing it now

livid cedar
#

or am i stupid

#

i might be stupid

kind drift
#

no

livid cedar
#

oh mb

kind drift
#

in serverscriptservice

livid cedar
#

yeah in hindsight i probably should have figured that out lmao

#

does the script have to be named anything specific so that the CharacterEvent can identify it?

ornate brookBOT
#

studio** You are now Level 1! **studio

livid cedar
#

sorry for all the questions, new to Lua and still don't fully know what i'm doing

kind drift
#

the script has to identify CharacterEvent not the otherway around

livid cedar
#

@kind drift yeah it uh

#

aint working

#

you there?

kind drift
#

yes

#

can i see your directory where you put your scripts and the gui script

livid cedar
#

ofc

#

holup brb

livid cedar
#

this is the gui script, just a simple text button

#

ignore my messy organization, still working some things out

kind drift
#

it needs to be a local script

livid cedar
#

ah

#

yeah that

#

that makes sense in hindsight

#

mb

#

i'll change it and test, brb

#

still not working

#

wait

livid cedar
#

because if so i am extraordinarily stupid

livid cedar
# livid cedar

made this a localscript and the main code a regular script, still non-functional

#

@kind drift u there? sorry to pester

kind drift
#

huh

livid cedar
#

well, i first tried making the main script a localscript, which didnt work

ornate brookBOT
#

studio** You are now Level 2! **studio

livid cedar
#

then realized you probably meant the gui script had to be local, so i swapped the main script back to standard and the gui script to local

#

which also didnt work

#

so there has to be something i'm doing wrong, i just cant figure out what

#

should they both be localscripts?

kind drift
#

no

#

only the gui

livid cedar
#

k, that's what ive done then

#

but it's still non-functional for some reason

kind drift
#

wait are there any scripts that need to be copied from 1 character to another

livid cedar
#

what do you mean?

kind drift
#

i mean

livid cedar
#

i mean, not what i know of, it's only changing the players avatar, nothing else

kind drift
#

oh ok

#

does it have a humanoidrootpart

livid cedar
#

i'll check but i believe so

livid cedar
#

i made the rig by just spawning an r15 model and scaling different sections, so

kind drift
#

why is is it waiting for screen gui

livid cedar
#

i'll be honest, i'm still pretty new to Lua and forgot how to program a click button GUI

#

i looked up a tutorial on how to make one

#

the morph is supposed to be triggered when a timer reaches zero, but i figured id throw together a simple gui just to make sure the code actually worked in a vacuum first

kind drift
#

remove the waitforchild (screengui) part

livid cedar
#

k

kind drift
#

and the colon

livid cedar
#

done

#

looks like this

#

ignore my simply amazing and definitely finalized title

kind drift
#

that should work

livid cedar
#

k, will try it

#

YES

#

thanks so much man

#

works almost perfectly

kind drift
#

the textbutton thing shouldn't be needed as it just legnthens the script as it's used only one time

#

just do script.Parent

livid cedar
#

makes sense

#

but yeah, this works near-perfectly now

#

thanks man

livid cedar
#

but that's fine, i can fix that later

#

thanks again! :D

kind drift
#

hold on

ornate brookBOT
#

studio** You are now Level 3! **studio

livid cedar
#

oh?

kind drift
#

is the animations in startercharacterscripts

livid cedar
#

because if so, no

kind drift
#

yes

#

where is it then

livid cedar
#

it's in the animate localscript for the entity

kind drift
#

oh hold on

#

delete this part of the main script

#

it removes the scripts inside the entity to replace with the startercharacter ones

livid cedar
kind drift
#

right below it

#

for _ to end

livid cedar
#

so including the
for . v in pairs(game.starter...
line?

kind drift
#

no

livid cedar
#

k

kind drift
#

nevermind i got confused

livid cedar
#

oh mb

#

so do i delete the For loop?

ornate brookBOT
#

studio** You are now Level 3! **studio

livid cedar
#

oh hey, look at that

#

chat rookie from talking in one help post

kind drift
livid cedar
kind drift
#

not the pairs(game.starterplyer part though

livid cedar
#

gotcha

kind drift
#

sorry if my screenshot was confusing

livid cedar
#

ur alg, dw

#

wait

#

so just the if loop?

#

just this?

kind drift
#

no

#

remove the if v is ascript and destroy part too

livid cedar
#

so all of this?

#

wait no

#

nvm

kind drift
#

yes

livid cedar
#

oh that works then

#

testing now

#

worked perfectly :D

#

thanks man

kind drift
#

np

#

just remember the roblox studio code is a bit different from actual lua

livid cedar
#

oh yeah, ofc

#

very much so

#

thanks again :D

kind drift
#

np

livid cedar
#

hey so @kind drift

#

sorry to keep pestering you but

#

is there a way of activating the event with another script?

kind drift
#

yes

#

you just fire it with the same code

livid cedar
#

oh, that's it?

#

that works then

livid cedar
#

gotcha, will test it rq

#

yeah, it didnt work

#

the rest of the script it was in worked, but the morph didnt occur

#

i can send the script it's in if need-be?

#

@kind drift

ornate brookBOT
#

studio** You are now Level 4! **studio

kind drift
livid cedar
#

line 15* is the trigger

#

all the script does is pick a random player as the killer, displaying it on their screen with a Gui and giving them a sword

#

the sword was just to make sure the script worked, wont be final

kind drift
#

oh is ee the problem

#

it doesn't have the player

livid cedar
#

ah

#

yeah with that, the script does save the players username in an ObjectValue in ReplicatedStorage on line 9

#

could i use that somehow?

livid cedar
#

afk

kind drift
#

player and then the character

livid cedar
#

you mean something like this?

kind drift
#

yes

livid cedar
#

k, will give it a shot

#

didn't work, have an idea tho

kind drift
#

what is it

ornate brookBOT
#

studio** You are now Level 4! **studio

livid cedar
#

could something like this work?

#

cause chosen is just the players username

#

so could this call on the specific player? maybe?

kind drift
#

maybe that will work

livid cedar
#

afraid not :/

kind drift
#

ah

#

so instead of copying the localscripts code isntead we copy the main script

#

ima do some edits

livid cedar
#

thanks

#

i am definitely not qualified to try and rework your code lmao

kind drift
#

replace the fire server thing with this

livid cedar
kind drift
#

yes and is now in the script your using

livid cedar
#

k

#

thx again for all of this

kind drift
#

hold on

#

i forgot to change chosenCharacter to "Brute"

#

thats all

livid cedar
#

alg

#

but also

livid cedar
livid cedar
kind drift
#

no

livid cedar
#

k, the gui script it is

livid cedar
kind drift
livid cedar
#

will test

kind drift
#

fixed code

livid cedar
#

thx, testing now

#

LETS GO

#

IT WORKS HELL YEAH

#

dude i genuinely cannot help you enough for this

kind drift
#

i'm still learning too

livid cedar
#

i literally started learning like 2-3 days ago you are 100% more qualified than me here

kind drift
#

i didn't know how to change a persons character not using a localscript and using a serverscript instead until now