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

Why isn't the function working?

Asked by
Txngo 5
10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Once the player presses and holds shift I want it to repeat and make the selection box fade and come back and repeat until they drop it or it hits 100 Its funny that I could code harder things but i fail at things like this :c


local ExoSkeleton = create{"Model", Parent = character, Name = "Skeleton"} for i,v in pairs(character:GetChildren()) do print("checking for parts") if v:IsA('Part') and v.Name ~= "Head" then create{"SelectionBox", Parent = ExoSkeleton, Name = "Outline", Transparency = 1, Adornee = v} end end local power = create{"NumberValue", Parent = player, Value = 0, Name = "Power"} while charging == false do wait() Exo = ExoSkeleton:GetChildren() for i,v in pairs(Exo) do if v:IsA("SelectionBox") then if power.Value == 100 then v.Transparency = 0 else x = math.random(70,100) v.Transparency = x*0.01 end end end end while wait() do mouse.KeyDown:connect(function(key)--i was in the middl of making the keydown function that checks what key it is and how long its being pressed if string.byte(key) == 017 or string.byte(key) == 016 then charging = true power.Value = power.Value +1 while wait() do Exo = ExoSkeleton:GetChildren() for i,v in pairs(Exo) do if v:IsA('SelectionBox') then for i = 1,100 do wait(0.5) v.Transparency = i*0.01 end end end end end end) end while wait() do mouse.KeyUp:connect(function(key) if string.byte(key) == 017 or string.byte(key) == 016 then charging = false end end) end

1 answer

Log in to vote
0
Answered by 9 years ago

I would suggest using

ExoSkeleton = Instance.new("Model")
Exoskeleton.Parent = character
Exoskeleton.Name = "Skeleton"
-- do the same using Instance.new as shown above for the other times you use "create"
Ad

Answer this question