Hello everybody I’m TheFoxCreator I’m currently trying to create a simple cutting system with an animation, but when I tested it it gave me this error:
I don’t know what is wrong in the code that that happens.
Here is the Code. And btw it’s a local script inside StarterChracterScripts.
local proximityPrompt = game.Workspace:WaitForChild("promppart"):FindFirstChild("ProximityPrompt")
local UIS = game:GetService("UserInputService")
local camera = game.Workspace.CurrentCamera
local gurke1 = workspace:FindFirstChild("gurke1")
local gurke2 = workspace:FindFirstChild("gurke2")
local gurke3 = workspace:FindFirstChild("gurke3")
local gurke4 = workspace:FindFirstChild("gurke4")
local gurke5 = workspace:FindFirstChild("gurke5")
local gurke6 = workspace:FindFirstChild("gurke6")
local gurke7 = workspace:FindFirstChild("gurke7")
local gurke8 = workspace:FindFirstChild("gurke8")
local gurke1ende = workspace:FindFirstChild("gurke1ende")
local gurke2ende = workspace:FindFirstChild("gurke2ende")
local gurke3ende = workspace:FindFirstChild("gurke3ende")
local gurke4ende = workspace:FindFirstChild("gurke4ende")
local gurke5ende = workspace:FindFirstChild("gurke5ende")
local gurke6ende = workspace:FindFirstChild("gurke6ende")
local gurke7ende = workspace:FindFirstChild("gurke7ende")
local gurke8ende = workspace:FindFirstChild("gurke8ende")
local howmanycut = 0
proximityPrompt.Triggered:Connect(function(player)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(workspace:FindFirstChild("cam").Position)
UIS.InputBegan:Connect(function(key, gameProcessed)
if key.UserInputType == Enum.UserInputType.MouseButton1 then
loadedAnim = script.Parent.Parent:FindFirstChild("Humanoid"):LoadAnimation(script.cut_anim)
loadedAnim:Play()
if not loadedAnim.IsPlaying then
if howmanycut == 0 then
gurke1.CFrame = gurke1ende.CFrame
gurke1.Orientation = gurke1ende.Orientation
howmanycut = 1
end
if howmanycut == 1 then
gurke2.CFrame = gurke2ende.CFrame
gurke2.Orientation = gurke2ende.Orientation
howmanycut = 2
end
if howmanycut == 2 then
gurke3.CFrame = gurke3ende.CFrame
gurke3.Orientation = gurke3ende.Orientation
howmanycut = 3
end
if howmanycut == 3 then
gurke4.CFrame = gurke4ende.CFrame
gurke4.Orientation = gurke4ende.Orientation
howmanycut = 4
end
if howmanycut == 4 then
gurke5.CFrame = gurke5ende.CFrame
gurke5.Orientation = gurke5ende.Orientation
howmanycut = 5
end
if howmanycut == 5 then
gurke6.CFrame = gurke6ende.CFrame
gurke6.Orientation = gurke6ende.Orientation
howmanycut = 6
end
if howmanycut == 6 then
gurke7.CFrame = gurke7ende.CFrame
gurke7.Orientation = gurke7ende.Orientation
howmanycut = 7
end
if howmanycut == 7 then
gurke8.CFrame = gurke8ende.CFrame
gurke8.Orientation = gurke8ende.Orientation
howmanycut = 8
end
end
end
end)
end)
If anyone finds the error please tell me! Thanks!