Hello, this is my first post on the Developer Forum as I am a beginner scripter. This local script allows me to press T and play an emote/pose for the player. I want to make it so that whenever any input is put through besides the mouse, it will stop the emote. I got it to work with the right mouse button, but the left click still stops the emote. I can’t seem to figure out how to add it to the if statement. I’ve tried adding
if input.UserInputType ~= Enum.UserInputType.MouseButton2 or Enum.UserInputType.MouseButton1 then
PoseTrack:Stop()
but it would not work. I have also tried a few other variations of it but still can not find a solution. The script that works with the right mouse button only is below.
game.Players.LocalPlayer.CharacterAdded:Wait()
wait(1)
local Pose = script.Pose
local player = game.Players.LocalPlayer
local char = player.Character
local hum = char.Humanoid
local PoseTrack = hum:LoadAnimation(Pose)
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.T then
PoseTrack:Play()
end
end)
UserInputService.InputBegan:Connect(function(input)
if input.UserInputType ~= Enum.UserInputType.MouseButton2 then
PoseTrack:Stop()
end
end)
while true do
if PoseTrack.IsPlaying == true then
player.Character.Humanoid.WalkSpeed = 0
player.Character.Humanoid.JumpPower = 0
end
if PoseTrack.IsPlaying == false then
player.Character.Humanoid.WalkSpeed = 16
player.Character.Humanoid.JumpPower = 50
end
wait()
end
I would be very thankful if anyone could help me with this. Thank you for reading and have a good day .