I have this script inside of StarterCharacterScripts and with this script i can play my pull up animation from anywhere. How can i make it so it can play only when you are sitting?
Script:
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character
local seat = game.Workspace.PullUpBar
local pullUpAnim = script:WaitForChild("PullUp")
local isPulling = false
local PullUpEvent = game.ReplicatedStorage:WaitForChild("OnClickPullUp")
UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if isPulling == true then return end
if not character:FindFirstChild("Humanoid") then return end
isPulling = true
local loadedAnim = character.Humanoid:LoadAnimation(pullUpAnim)
loadedAnim:Play()
PullUpEvent:FireServer()
wait(2)
isPulling = false
end
end)
Id like to know how to fix this, could be simple or could be a bit too difficult for me