Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Global (humanoid) is only used in the enclosing function; consider changing it to local?

Asked by 3 years ago

Hello, I'm working on a new Pokemon game. It's been years since these scripts were updated and they no longer work, however I'm having some trouble figuring out why.

In the "LeafBlade1" script (second script listed), the humanoid in line 2 and the d in line 17 both have a blue line under them, hovering over them states, "Global (name) is only used in the enclosing function; consider changing it to local".

Here's the script for the move Tackle, telling the move what to look like.

bin = script.Parent
me = script.Parent.Parent.Parent

enabled = true

function onButton1Down(mouse)
if not enabled then
        return
    end

    local player = game.Players.LocalPlayer
    if player == nil then return end
        enabled = false


    mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"

t = me.Character:findFirstChild("Torso")
if t ~= nil then

hax = game.Lighting.LeafBlade1:clone()
hax.Parent = t
wait(0.05)
p = Instance.new("Part")
p.Parent = game.Workspace
p.CanCollide = false
p.Transparency = 1
p.CFrame = me.Character.Torso.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 0)
d = Instance.new("BodyVelocity")
d.Parent = me.Character.Torso
d.maxForce = Vector3.new(math.huge, math.huge, math.huge)
d.velocity = p.CFrame.lookVector * 100
me.Character.Torso.CFrame = me.Character.Torso.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 0)
wait(0.15)

d:Remove()
p:Remove()
wait(0.1)
hax:Remove()

wait(3)
    mouse.Icon = "rbxasset://textures\\GunCursor.png"
    enabled = true

end
end


function onS(mouse) 
mouse.Button1Down:connect(function() onButton1Down(mouse) end) 
end 
bin.Selected:connect(onS)

and now the "LeadBlade1", choosing the damage the move will do.

function onTouched(hit)
humanoid = hit.Parent.Parent:findFirstChild("Humanoid")
if humanoid ~= nil then
if humanoid.Parent ~= script.Parent.Parent then
humanoid.Health = humanoid.Health - 20
hit.CFrame = hit.CFrame * CFrame.fromEulerAnglesXYZ(-0.4, 0, 0)
for i = 1 , 1 do
p = Instance.new("Part")
p.Parent = game.Workspace
p.CanCollide = false
p.BrickColor = BrickColor.new(21)
p.Size = Vector3.new(1, 1, 1)
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.CFrame = hit.CFrame
p.Velocity = Vector3.new(math.random(-50, 50), math.random(30, 50), math.random(-50, 50))
d = Instance.new("SpecialMesh")
d.Parent = p
d.MeshType = "Brick"
d.Scale = Vector3.new(0.2, 0.2, 0.2)
game:GetService("Debris"):AddItem(p,5)
end
end
end
end
script.Parent.Touched:connect(onTouched)

As I said, it's been years since these have been updated, so any help fixing it will be awesome. Thanks!

0
Not sure, although it’d be really careful with that Pokémon game. Nintendo usually takes down games related the company. builderboi9r9r9r 5 — 3y

Answer this question