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

Shield Scripting; Something broke?

Asked by 9 years ago

Tried this before, but I guess the script was too long, I shortened it, hopefully you guys can find the error. What's susposed to happen is when you press "e" the shield should go into blocking position, but for some reason it's not working. Know why it's not working?

function shieldUp(guy) if combo ~= 1 and go ~= 0 then return end if su == false then su = true shield1 = true Tool.Shielding.Value = true weld10 = weld1.C0 weld11 = weld1.C1 weld20 = weld2.C0 weld21 = weld2.C1

weld2.C0 = CFrame.new(1.5,0.5,0) weld2.C1 = CFrame.new(0,0.5,0)*CFrame.fromEulerAnglesXYZ(math.pi/-2, 0, 0) weld1.C0 = CFrame.new(-1.5,0.5,0)

Tool.Handle.ShieldUp:play()

guy["Humanoid"].WalkSpeed = 8

for i=1,5 do weld1.C0 = weld1.C0 * CFrame.fromEulerAnglesXYZ(math.pi/64, math.pi/-20, math.pi/64) + Vector3.new(0.05,-0.04,-0.15) weld2.C0 = weld2.C0 * CFrame.fromEulerAnglesXYZ(math.pi/-10, 0, math.pi/-128) wait() end

local hum = guy:findFirstChild("Humanoid") if hum ~= nil then oldHealth = hum.Health con1 = hum.ChildAdded:connect(function(cr) if cr.Name == "creator" then checkBlock(guy,hum,cr) end end) end

shieldLoop(guy)

su = false end end

function shieldLoop(guy)

while true do

if Tool.Parent ~= guy then shieldDown(guy) return end

if eCheck() == false then wait(0.1) shieldDown(guy) return end

if guy["Humanoid"].WalkSpeed > 8 then guy["Humanoid"].WalkSpeed = 8 end

sap((Tool.Energy.Value)/10) if Tool.Shielding.Value == false then break end

wait(0.1)

end

shieldDown(guy)

end

function eDown(key) local guy = Tool.Parent local p = game.Players:GetPlayerFromCharacter(guy) if Tool.Shielding.Value == false and shield1 == false and Tool.Go.Value == true then if key == "e" then shieldUp(guy) end end end

function eUp(key) if key == "e" then Tool.Shielding.Value = false end end

0
Please put your code in a .lua code block, so we can read it easier. :) Also, I'm very sorry, I Jumped the gun and thought your Question was a Duplicate. :( TheeDeathCaster 2368 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Sorry about the code, didn't see the box option

function shieldUp(guy) if combo ~= 1 and go ~= 0 then return end if su == false then su = true shield1 = true Tool.Shielding.Value = true weld10 = weld1.C0 weld11 = weld1.C1 weld20 = weld2.C0 weld21 = weld2.C1

weld2.C0 = CFrame.new(1.5,0.5,0) weld2.C1 = CFrame.new(0,0.5,0)*CFrame.fromEulerAnglesXYZ(math.pi/-2, 0, 0) weld1.C0 = CFrame.new(-1.5,0.5,0)

Tool.Handle.ShieldUp:play()

guy["Humanoid"].WalkSpeed = 8

for i=1,5 do weld1.C0 = weld1.C0 * CFrame.fromEulerAnglesXYZ(math.pi/64, math.pi/-20, math.pi/64) + Vector3.new(0.05,-0.04,-0.15) weld2.C0 = weld2.C0 * CFrame.fromEulerAnglesXYZ(math.pi/-10, 0, math.pi/-128) wait() end

local hum = guy:findFirstChild("Humanoid") if hum ~= nil then oldHealth = hum.Health con1 = hum.ChildAdded:connect(function(cr) if cr.Name == "creator" then checkBlock(guy,hum,cr) end end) end

shieldLoop(guy)

su = false end end

function shieldLoop(guy)

while true do

if Tool.Parent ~= guy then shieldDown(guy) return end

if eCheck() == false then wait(0.1) shieldDown(guy) return end

if guy["Humanoid"].WalkSpeed > 8 then guy["Humanoid"].WalkSpeed = 8 end

sap((Tool.Energy.Value)/10) if Tool.Shielding.Value == false then break end

wait(0.1)

end

shieldDown(guy)

end

function eDown(key) local guy = Tool.Parent local p = game.Players:GetPlayerFromCharacter(guy) if Tool.Shielding.Value == false and shield1 == false and Tool.Go.Value == true then if key == "e" then shieldUp(guy) end end end

function eUp(key) if key == "e" then Tool.Shielding.Value = false end end

0
From how I'm reading the code, your not calling the functions anywhere. o_e TheeDeathCaster 2368 — 9y
0
Eh, nvm then guess I'm in need of an expert. ThePowerEmporer 0 — 9y
Ad

Answer this question