Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Activating Script via. KeyBind?????

Hello everyone!

//TLDR: I spawn as a Werewolf. But how can I make sure I only morph when I press, for example, E? I know how UserInputService works, it's just that I don't know the proper method.

I have a Script in ServerScriptService which Clones the CustomCharacter Model in ServerStorage into Workspace. This essentially morphs the player into a "Werewolf" (Slavic Mythology)

However, I want it to work with a key-bind, such as UserInputService. The only problem surrounding this, is that key-binds only work from a LocalScript. The essential part, is that when I press 'E' once it will morph me, and when I press it again my normal character should appear.

Overall, what I want to ask you is how this can be accomplished. The method I tried was creating a BoolValue, which is what I normally do, unfortunately something just isn't right... Because I created it in order to Disable/Enable the Script which morphs me into the Werewolf.

Any solutions? Thank you in advance.

The following script below, is placed in SSS, but it may also work in Workspace, and is responsible for morphing the user into a specified model located in SS.

Link to the script ...

8 comments

0

Remote events/functions

0

I understand that aspect, however, for now I would like to receive a solution the way it is.

0

Basically, how can I morph into the Werewolf using a key-bind? I know how key-binds work; it's the script that I need to take care of. I also received no errors during both, studio test mode & website play mode.

0

Make the binded key call FireServer() on a Remote Event and then have a regular script handle the player's morphing.

0

Oh, I see what you mean, you need help in regards of the morphing process. My bad, was misleaded by the title.

0

Would you like to see the Scipt which handles the morphing?

0

I'm not experienced in that subject, however I still recommend you to post the morhping script for people to be able to diagnose it properly.

0

Change your question to "How to morph player's character without reloading?" otherwise you won't get the correct answer

1 answer

Like this:

userinput = game:GetService("UserInputService")
if userinput:IsKeyDown(Enum.KeyCode.101) then
	-- Your code here
end

Quite simple, really. Enum also lets you type the letter instead of the number, so if you want to do that instead then go ahead.

3 comments

0

But it doesn't work that way, I want the player to morph just like that without resetting. Games like Ben 10 have done it.

0

Use LoadCharacter() in the code then.

This discussion is preserved as it was. New answers, comments, and votes are closed.