Hello can anyone help as to why this code wont work. It is meant to play an animation when I press B. Thanks :D
Main Script:
local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = Player.Character
game.ReplicatedStorage.BBQPressBToUse.OnServerEvent:Connect(function(plr)
UIS.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.B then
Character.Humanoid.Walkspeed = 16
local Anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://2305757864"
local PlayAnim = Character.RightArm:LoadAnimation(Anim)
PlayAnim:Play()
end
end)
-- Scripting Helpers: Not completed down below :D
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.B then
Character.Walkspeed = 16
end
end)
LocalScript (For RemoteEvent)
game:GetService("UserInputService").InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.B then
game.ReplicatedStorage.BBQPressBToUse:FireServer()
end
end)
Thanks ;D

1 comment
It's not character.walkspeed it's character.Humanoid.Walkspeed. Please post a picture of your error log.