I am making a baseball game and ran into a problem I can't fix. So basically, when someone enters the batters box, I want them to have 0 walkspeed. I know that it has to do with the humanoid, but problem is I just dont know how to implement it and I've tried everything. Help would be appreciated
-- Variables/Other local IsBatting = false local RH = game.Workspace.PlayerParts.RH local LH = game.Workspace.PlayerParts.LH -- Camera Stuff local Camera = workspace.CurrentCamera local TweenService = game:GetService("TweenService") local BatterCamera = game.Workspace.MouseIgnores.BatterCamera -- Character/Player Stuff local Player = game.Players.LocalPlayer -- Functions function TweenCamera() Camera.CameraType = Enum.CameraType.Scriptable local TI = TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0) -- Duration, Style, Direction, How many times repeated local Goal = {CFrame = BatterCamera.CFrame, FieldOfView = 60} local Animation = TweenService:Create(Camera, TI, Goal) Animation:Play() end function StartAtBat(WhichSide) if IsBatting then -- Checks if there is already a person batting return else IsBatting = true end TweenCamera() end RH.Touched:Connect(function() StartAtBat(RH) end) LH.Touched:Connect(function() StartAtBat(LH) end)
All you need to do is change the player variable.
local Player = game.Players.LocalPlayer.Character.Humanoid Player.WalkSpeed = 0