I keep getting this error and I dont know why I don care if you just give me the fix but I would prefer to know why its happening and how to fix it myself

local RE = game:GetService("ReplicatedStorage"):WaitForChild("RE")

RE.OnServerEvent:connect(function(player, request, data)

if request == "sprint" then

player.Character.Humanoid.WalkSpeed = data(1)

end

end)

heres the other part of the script in case its needed

local CAS = game:GetService("ContextActionService")

local RE = game:GetService("ReplicatedStorage"):WaitForChild("RE")

local fill = script.Parent:WaitForChild("Top"):WaitForChild("fill")

local stam = 50

local speed = 16

local function sprint(str, state, object)

speed = state == Enum.UserInputState.Begin and 24 or 16

RE:FireServer("sprint", (speed))

end

CAS:BindAction("sprint", sprint, true, Enum.KeyCode.LeftShift)

6 comments

0

because data is a number, not an array

0

and numbers dont have indexes

0

See what I dont understand though is i was watching a video of someone doing it and it worked perfectly fine for him

0

if you wanted (speed) to be an array, use {} rather than () (just for that part)

0

OMG THANK YOU SO MUCH!!!!!!!!

0

np :3