Hello Devs! I Am Making a Lil Sprint Script For My Game And I Made A Remote Event That Changes The Bool Value To True / False, But When I Fire The Event It Gives This Error :
I Dont Really Undestand This Error So I Was Hoping One Of You Can Help.
Server Script (ServerScriptService) :
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerEvents = ReplicatedStorage:WaitForChild("Events"):WaitForChild("Server")
ServerEvents.ChangeBoolValue.OnServerEvent:Connect(function(ValueObject: BoolValue, newValue: boolean)
ValueObject.Value = newValue
end)
Sprint Script (StarterCharacterScripts) :
local Player = game.Players.LocalPlayer
local Character = script.Parent
local Humanoid:Humanoid = Character:WaitForChild("Humanoid")
local SprintSpeed = 16
local WalkSpeed = 10
local CrouchSpeed = 6
local CrouchAnim = Humanoid:LoadAnimation(script.CrouchAnim)
local UserInputService = game:GetService("UserInputService")
local CanSprint = Character:WaitForChild("Values"):WaitForChild("CanSprint")
local CanCrouch = Character:WaitForChild("Values"):WaitForChild("CanCrouch")
local IsSprinting = Character:WaitForChild("Values"):WaitForChild("IsSprinting")
local IsCrouching = Character:WaitForChild("Values"):WaitForChild("IsCrouching")
local ChangeValueEvent = game:GetService("ReplicatedStorage"):WaitForChild("Events"):WaitForChild("Server"):WaitForChild("ChangeBoolValue")
-- Sprint Script --
UserInputService.InputBegan:Connect(function(input:InputObject, gameProcessedEvent:boolean)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode.LeftShift and CanSprint.Value == true and IsCrouching.Value == false and IsSprinting.Value == false then
Humanoid.WalkSpeed = SprintSpeed
ChangeValueEvent:FireServer(IsSprinting, true)
end
end)
UserInputService.InputEnded:Connect(function(input:InputObject, gameProcessedEvent:boolean)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode.LeftShift and CanSprint.Value == true and IsCrouching.Value == false and IsSprinting.Value == true then
Humanoid.WalkSpeed = WalkSpeed
ChangeValueEvent:FireServer(IsSprinting, false)
end
end)
Any Help Would Be Gladly Appreciated!