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

Why am i getting an error for this explosion spell?

This is a spell so when I cast it there's supposed to be an explosion but it doesn't work at all and in output, I get "18:12:30.136 Position is not a valid member of Model "Workspace.Dummy" - Server - bombarda:5" can someone explain whats wrong I'm so confused

local Part = script.Parent
--
local ex = Instance.new("Explosion")
ex.ExplosionType = Enum.ExplosionType.NoCraters
ex.Position = Part.Position
ex.BlastPressure = 0
ex.BlastRadius = 0
ex.Parent = Part
for _, v in pairs(game.Players:GetPlayers()) do
	if (Part.Position - v.Character.HumanoidRootPart.Position).magnitude <= 12.5 then
		coroutine.wrap(function()
			v.Character.Humanoid:TakeDamage(40)
			local humanoid = v.Character.Humanoid
			local torso = v.Character.HumanoidRootPart
			--
			humanoid.PlatformStand=true
			torso.CFrame=torso.CFrame*CFrame.new(0,0.2,0)*CFrame.Angles(-.5,0,math.random(0,0))
			torso.Velocity=torso.CFrame.lookVector*-150
			wait(3)
			humanoid.PlatformStand=false
		end)();
	end
end
--
wait()
script:Destroy()

2 comments

0

On line 2, try removing the --

0

nope lol

1 answer

✓ Accepted answer

classic mistake. It says Position is not a valid member of model Dummy. This means you cannot position whole models. Instead, do this.

local Part = script.Parent.HumanoidRootPart

local ex = Instance.new("Explosion")
ex.ExplosionType = Enum.ExplosionType.NoCraters
ex.Position = Part.Position
ex.BlastPressure = 0
ex.BlastRadius = 0
ex.Parent = Part
for _, v in pairs(game.Players:GetPlayers()) do
    local chr = game.Workspace:FindFirstChild(""..v.Name)
    if (Part.Position - chr.HumanoidRootPart.Position).magnitude <= 12.5 then
        coroutine.wrap(function()
            chr.Humanoid:TakeDamage(40)
            local humanoid = v.Character.Humanoid
            local torso = chr.HumanoidRootPart

            humanoid.PlatformStand=true
            torso.CFrame=torso.CFrame*CFrame.new(0,0.2,0)*CFrame.Angles(-.5,0,math.random(0,0))
            torso.Velocity=torso.CFrame.lookVector*-150
            wait(3)
            humanoid.PlatformStand=false
        end)();
    end
end

wait()
script:Destroy()

so basically, position is not a model's property. It is only a property of baseparts, negativeparts, meshparts, unions and explosions, not whole models. It's annoying but you'll get used to it. Basically what I did is change the first line from the dummy to the dummy's humanoidrootpart (the center of the dummy)

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