I’m trying to create a hitbox for a Power up and i trying to get a variable from a module script but it keeps giving me an error
ServerScriptService.Spin_Server:33: attempt to index nil with ‘CFrame’
local RepStorage = game:GetService('ReplicatedStorage')
local spin = RepStorage:WaitForChild('Spin')
local VfxHandeler = game.StarterPack.Vfx_Handler.Vfx_Handler_Client
local SpinVfx = require(VfxHandeler.Spin_Vfx)
local Meshes = game.StarterPack.Vfx_Handler.Vfx_Handler_Client.Spin_Vfx.Meshes
local TweenService = game:GetService('TweenService')
local SpinModule = require(script.Spin_Module)
spin.OnServerEvent:Connect(function(plr)
local char = plr.Character
local hum = char:WaitForChild('Humanoid')
local humrp = char:WaitForChild('HumanoidRootPart')
local folder = Instance.new('Folder')
folder.Name = plr.Name..' Spin Move'
folder.Parent = workspace
game.Debris:AddItem(folder,5)
spawn(function()
SpinModule.create(plr,char,humrp,folder)
end)
delay(5, function()
spin:FireClient(plr)
end)
wait(folder:GetChildren())
local Sphere = SpinVfx.Sphere
local Hitbox = script:WaitForChild('Hitbox'):Clone()
Hitbox.CFrame = Sphere.CFrame
Hitbox.Size = Vector3.new(1.5,1.5,1.5)
Hitbox.Transparency = 0.8
Hitbox.Parent = folder
TweenService:Create(Hitbox, TweenInfo.new(.5),{Size = Vector3.new(23, 15, 23)}):Play()
Hitbox.Touched:Connect(function(hit)
if hit:IsA('BasePart') then
if not hit:IsDescendantOf(char) then
local enemyHumanoid = hit.Parent:FindFirstChild('Humanoid')
local enemyHPR = hit.Parent:FindFirstChild('HumanoidRootPart')
if enemyHumanoid and enemyHPR then
spawn(function()
SpinModule.Damage(char,humrp,2)
end)
end
end
end
end)
end)
I’ve tried printing sphere and it printed nil.