Getting error: Unable to cast token to token
Heres the script:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local UIS = game:GetService("UserInputService")
local target = nil
local isholdingdown = false
UIS.InputChanged:Connect(function(input)
if UIS:IsKeyDown(Enum.UserInputType.MouseButton1) == true then --Error on this line
isholdingdown = true
game.ReplicatedStorage.CreatePart:FireServer(target, mouse.Hit.Position, isholdingdown)
elseif UIS:IsKeyDown(Enum.UserInputType.MouseButton1) == false then
isholdingdown = false
game.ReplicatedStorage.CreatePart:FireServer(target, mouse.Hit.Position, isholdingdown)
end
end)
mouse.Move:Connect(function()
target = mouse.Target
if not target then
mouse.Icon = 'http://www.roblox.com/asset/?id=591711615'
else
if target:IsA("BasePart") or target:IsA("Model") then
if target == workspace.Base or target == workspace.Base2 or target.Parent == workspace.Map then
mouse.Icon = 'http://www.roblox.com/asset/?id=6888146193'
else
mouse.Icon = 'http://www.roblox.com/asset/?id=591711615'
end
end
end
end)