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

Activating Script via. KeyBind?????

Asked by 6 years ago
Edited 6 years ago

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 ...

0
Remote events/functions Le_Teapots 913 — 6y
0
I understand that aspect, however, for now I would like to receive a solution the way it is. dareveloper 9 — 6y
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. dareveloper 9 — 6y
0
Make the binded key call FireServer() on a Remote Event and then have a regular script handle the player's morphing. Le_Teapots 913 — 6y
View all comments (4 more)
0
Oh, I see what you mean, you need help in regards of the morphing process. My bad, was misleaded by the title. Le_Teapots 913 — 6y
0
Would you like to see the Scipt which handles the morphing? dareveloper 9 — 6y
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. Le_Teapots 913 — 6y
0
Change your question to "How to morph player's character without reloading?" otherwise you won't get the correct answer MooMooThalahlah 421 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

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. dareveloper 9 — 6y
0
Use LoadCharacter() in the code then. DeceptiveCaster 3761 — 6y
Ad

Answer this question