What do you want to achieve? Keep it simple and clear!
i want to achieve that on key press, player can kick doors
What is the issue? Include screenshots / videos if possible!
the animation just doesn’t play but it prints in the output like it did
can’t really attach file since my wifi is very very slow right now
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i looked all over but nothing helped me
also tried to just disable all other animations but it just errors that “Animate is not a valid member”(Animate because i wanted to disable the script which just resumes them) but in properties i can very clearly see that it’s there
animation priority: action
script located: starterGUI
not any group animation
Code:
local char
repeat
wait()
char = game.Players.LocalPlayer.Character
until char
local hum = char:FindFirstChildWhichIsA("Humanoid")
repeat
wait()
hum = char:FindFirstChildWhichIsA("Humanoid")
until hum
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(inp,ign)
if inp.KeyCode == Enum.KeyCode[script.Parent.controls.kickdoor.Value] and not ign then
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://8766667358"
print(anim,anim.AnimationId)
local a = hum:LoadAnimation(anim)
print(a)
a:Play()
end
end)
local player = game.Players.LocalPlayer
local char = player.CharacterAdded:Wait()
local hum = char:FindFirstChildOfClass("Humanoid")
local uis = game:GetService("UserInputService")
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://8766667358"
local a = hum:LoadAnimation(anim)
uis.InputBegan:Connect(function(inp,ign)
if inp.KeyCode == Enum.KeyCode[script.Parent.controls.kickdoor.Value] and not ign then
a:Play()
end
end)
I noticed ur code has a lot of un-needed lines, so i removed them and cleaned it up a bit, maybe try the code that i’ve given you above
local player = game.Players.LocalPlayer
local char = player.CharacterAdded:Wait()
local hum = char:FindFirstChildOfClass("Humanoid")
local uis = game:GetService("UserInputService")
local anim = Instance.new("Animation", script)
anim.AnimationId = "rbxassetid://8766667358"
local a = hum:LoadAnimation(anim)
uis.InputBegan:Connect(function(inp,ign)
if inp.KeyCode == Enum.KeyCode[script.Parent.controls.kickdoor.Value] then
a:Play()
end
end)
Try using this script, i removed the gameloaded check from the InputBegan function, and I also suggest that you change it from Enum.KeyCode[script.Parent.controls.kickdoor.Value] to Enum.KeyCode.K or whichever key you prefer
still did not work
your script just kind of stopped on CharacterAdded for some reason, i applied print to both before the CharacterAdded and after and it only printed before the loading so like the characterAdded event never fires or something, i don’t know
also i don’t think this has to do with script since when i try my script it prints everything but just plays no animation.
yes, it’s published by me
and im pretty sure it loaded because when i did print to see how many objects remaining are in ContentProvider and it printed 0 so its not the fault of my connection
local userInput = game:GetService("UserInputService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://8766667358"
local track = humanoid:LoadAnimation(animation)
userInput.InputBegan:Connect(function(key, processed)
if processed then
return
end
if track.IsPlaying then
return
end
if key.KeyCode == Enum.KeyCode.F then
track:Play()
end
end)