Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Unable to cast token int?

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

✓ Accepted answer

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!

1 comment

0

yay thx

This discussion is preserved as it was. New answers, comments, and votes are closed.