You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to achieve a system where, if you’re morphed into a character, it checks if you’re that character and when you press a key, it play animation.
What is the issue? Include screenshots / videos if possible!
None, I’m new to scripting.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried some kits, but either the scripts weren’t tested or were rushed.
Anyways, any help is welcome. I only know a bit of things like variables and stuff, but not how to position them in an actual script.
To check the morph, have so many ways to do this, you can put a StringValue inside the morph and set the Value of the StringValue to the morph name, then you use a script to check the value of the StringValue
LocalScript exemple:
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
--This is a service to check player inputs, check the docs of this service to know more.
local UserInputService = game:GetService("UserInputService")
--[[
Everytime the player press a button or so something in the game, will fire a input and will
call this function below.
--]]
UserInputService.InputBegan:Connect(function(input, interaction)
--Checking if the player dont fired a input while interacting with something in the game
if not interaction then
if input.KeyCode == Enum.KeyCode.R then
if Character then
--Checking if StringValue exist in the character, you can name with what name you want, but you will need to change the name here too
if Character:FindFirstChild("StringValue") then
if Character.StringValue.Value == "Player" then
--do something...
elseif Character.StringValue.Value == "idk" then
--do something...
end
end
end
end
end
end)