Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Unable to cast token int?

Asked by
adcd433 12
3 years ago
local Tool = script.Parent
local UserInputService = game:GetService("UserInputService")
local ContextActionService= game:GetService("ContextActionService")
local Cam = workspace.CurrentCamera
local function MoveForward()
    Cam.CFrame = Cam.CFrame*CFrame.new(5,0,0)

end
Tool.Equipped:Connect(function()
    while true do
        wait()
        if UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)then
            Cam.CameraType = Enum.CameraType.Scriptable
            Cam.CFrame = CFrame.new(Vector3.new(0,10,0),Vector3.new(0,0,0))
            ContextActionService:BindActionAtPriority("MoveForward",MoveForward,false,Enum.KeyCode.W,2500)
        end
    end
end)

it says the error is on line fifteen and i assume its talking about the last argument 2500 Also it says on the error message Unable to cast token int

1 answer

Log in to vote
0
Answered by
Pupppy44 671 Moderation Voter
3 years ago

Where Enum.KeyCode.W is, that's where the PriorityLevel should be. Switch them around:

ContextActionService:BindActionAtPriority("MoveForward",MoveForward,false,2500, Enum.KeyCode.W)

Hope this helps!

0
yay thx adcd433 12 — 3y
Ad

Answer this question