So I have this morph. I also have this script that reappears and disappears an object (MeshPart). When put on the morph, it only affects the morph's dummy. How would I go about making a MeshPart on the morph I am using reappear and disappear at the press of a key (LeftShift) while the robloxian is still using it. Here is what I have so far.
local UserInputService = game:GetService("UserInputService")
local localPlayer = game.Players.LocalPlayer
local cloneSound = game.Workspace["Sound3"]:Clone()
cloneSound.Parent = localPlayer.Character
local function onInputBegan(input, gameProcessed)
if input.UserInputType == Enum.UserInputType.Keyboard then
local keyPressed = input.KeyCode
if keyPressed == Enum.KeyCode.LeftShift then
cloneSound:Play() -- Replace with "Resume()" if you want to play from where it left off last.
game.Workspace["Poop"].Chest.boostout.Transparency = 0.3
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 95
end
end
end
local function onInputEnded(input, gameProcessed)
if input.UserInputType == Enum.UserInputType.Keyboard then
local keyPressed = input.KeyCode
if keyPressed == Enum.KeyCode.LeftShift then
cloneSound:Stop() -- Replace with "Pause()" if you want to pause instead of stop.
game.Workspace["Poop"].Chest.boostout.Transparency = 1
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 90
end
end
end
UserInputService.InputBegan:connect(onInputBegan)
UserInputService.InputEnded:connect(onInputEnded)
