generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Editing gear script

Previous Thread :: Next Thread 
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
17 Apr 2015 10:52 AM
I'm using scripts from the gear 'Giant Blade' for swords in my game, which are used to kill zombies. I have tried removing the GetPlayerFromCharacter part and changing the second ("Humanoid") to ("Zombie"), but it still doesn't work. Please can someone help edit the script so that it kills zombies? (Note: the GetPlayerFromCharacter part is still in the script).


function waitfor(a,b)
while a:FindFirstChild(b)==nil do
a.ChildAdded:wait()
end
return a:FindFirstChild(b)
end

reloading=waitfor(sp,"Reloading")
down=waitfor(sp,"MouseDown")
runanim=waitfor(sp,"RunAnim")
debris=game:getService("Debris")
weaponhud=waitfor(sp,"WeaponHud")
guibar=waitfor(weaponhud,"Bar")
guibarfill=waitfor(guibar,"Fill")

function runsound(id,volume)
local volume=volume or 1
local sound=Instance.new("Sound")
sound.Looped=false
sound.Pitch=1
sound.SoundId="http://www.roblox.com/asset/?id="..tostring(id)
sound.PlayOnRemove=false
sound.Volume=volume
debris:AddItem(sound,3)
sound.Parent=sp.Handle
wait()
sound:Play()
end

function billboard(pos,text,time,color)
local pos=pos or Vector3.new(0,0,0)
local text=text or "Hello World!"
local time=time or 2
local color=color or Color3.new(1,0,0)
local pos=pos+Vector3.new(0,5,0)
local ep=Instance.new("Part")
ep.Name="Effect"
ep.formFactor="Custom"
ep.Size=Vector3.new(0,0,0)
ep.TopSurface="Smooth"
ep.BottomSurface="Smooth"
ep.CFrame=CFrame.new(pos)
ep.Anchored=true
ep.CanCollide=false
ep.Transparency=1
local bb=Instance.new("BillboardGui")
bb.Size=UDim2.new(3,0,3,0)
bb.Adornee=ep
local tl=Instance.new("TextLabel")
tl.BackgroundTransparency=1
tl.Size=UDim2.new(1,0,1,0)
tl.Text=text
tl.TextColor3=color
tl.TextScaled=true
tl.Font="ArialBold"

tl.Parent=bb
bb.Parent=ep
debris:AddItem(ep,time+.1)
ep.Parent=game.Workspace
delay(0,function()
local frames=time/rate
for frame=1,frames do
wait(rate)
local percent=frame/frames
ep.CFrame=CFrame.new(pos)+Vector3.new(0,5*percent,0)
tl.TextTransparency=percent
end
ep:remove()
end)
end

sp.Handle.Touched:connect(function(hit)
if ready and equipped and hit and hit.Parent~=nil and hit:IsDescendantOf(sp.Parent)==false and string.lower(string.sub(hit.Name,1,6))~="effect" and (tick()-lastswing)<=damagewindow then
if hit:FindFirstChild("CanBlock") and sp.Handle:FindFirstChild("Blockable") then
ready=false
runsound(clashsounds[math.random(1,#clashsounds)])
delay(.2,function()
end)
billboard(sp.Handle.Position,"Block",2,Color3.new(1,1,0))
end
local mh=sp.Parent:FindFirstChild("Humanoid")
local eh=hit.Parent:FindFirstChild("Zombie")
local ra=sp.Parent:FindFirstChild("Right Arm")
local plr=game.Players:GetPlayerFromCharacter(sp.Parent)
if mh and eh and eh~=mh and mh.Health>0 and eh.Health>0 and ra and plr~=nil then
if not plr.Neutral then
local eplr=game.Players:GetPlayerFromCharacter(eh.Parent)
if eplr~=nil and eplr.Neutral==false and eplr.TeamColor==plr.TeamColor then
return --No team killing
end
end
ready=false
for i,v in ipairs(eh:GetChildren()) do
if v.Name=="creator" then
v:remove()
end
end
local creator=Instance.new("ObjectValue")
creator.Name="creator"
creator.Value=plr
creator.Parent=eh
debris:AddItem(creator,1)
local localdamage=math.floor(damage*(.9+(math.random()*.2)))
eh:TakeDamage(localdamage)
billboard(hit.Position,"-"..tostring(localdamage))
runsound(hitsounds[math.random(1,#hitsounds)])
local bloodeffects=math.ceil(localdamage/10)
for i=1,math.random(bloodeffects-1,bloodeffects+1) do
end
end
end
end)


function Activate()
if equipped and (tick()-lastswing)>=swingrate then
ready=true
reloading.Value=true

runsound(swooshsounds[math.random(1,#swooshsounds)],.5)

local newanim=anims[math.random(1,#anims)]
while newanim==runanim.Value do
newanim=anims[math.random(1,#anims)]
end
runanim.Value=newanim

lastswing=tick()
updategui()

wait(swingrate)

reloading.Value=false
if down.Value then
Activate()
end
end
end

down.Changed:connect(function()
if down.Value then
Activate()
end
end)

function updategui()
local swingpercent=math.min((tick()-lastswing)/swingrate,1)
if swingpercent<.5 then --fade from red to yellow then to green
guibarfill.BackgroundColor3=Color3.new(1,swingpercent*2,0)
else
guibarfill.BackgroundColor3=Color3.new(1-((swingpercent-.5)/.5),1,0)
end
guibarfill.Size=UDim2.new(swingpercent,0,1,0)
end

sp.Equipped:connect(function(mouse)
lastswing=tick()
updategui()

reloading.Value=true
ready=false
equipped=true

delay(0,function() --HAAB (Hacking around a bug)
local plr=game.Players:GetPlayerFromCharacter(sp.Parent)
if plr~=nil then
local plrgui=plr:FindFirstChild("PlayerGui")
if plrgui~=nil and weaponhud~=nil then
weaponhud.Parent=plrgui
while equipped do
updategui()
wait(rate)
end
end
end
end)

wait(swingrate)

reloading.Value=false
if down.Value then
Activate()
end
end)

sp.Unequipped:connect(function()
ready=false
equipped=false
delay(0,function() --HAAB
weaponhud.Parent=sp
end)
end)
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
17 Apr 2015 12:34 PM
bump
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
17 Apr 2015 01:58 PM
bump
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
18 Apr 2015 01:20 AM
Please help. Bump.
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
18 Apr 2015 02:53 AM
bump
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
18 Apr 2015 04:08 AM
bump
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
18 Apr 2015 11:33 AM
bump
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
18 Apr 2015 11:38 AM
The best way for you to get an answer is to cut down on the code. Try finding the place where the problem occurs, then post that piece of code.
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
18 Apr 2015 12:02 PM
I'm not sure myself, but I think it would be in this part:

sp.Handle.Touched:connect(function(hit)
if ready and equipped and hit and hit.Parent~=nil and hit:IsDescendantOf(sp.Parent)==false and string.lower(string.sub(hit.Name,1,6))~="effect" and (tick()-lastswing)<=damagewindow then
if hit:FindFirstChild("CanBlock") and sp.Handle:FindFirstChild("Blockable") then
ready=false
runsound(clashsounds[math.random(1,#clashsounds)])
delay(.2,function()
end)
billboard(sp.Handle.Position,"Block",2,Color3.new(1,1,0))
end
local mh=sp.Parent:FindFirstChild("Humanoid")
local eh=hit.Parent:FindFirstChild("Zombie")
local ra=sp.Parent:FindFirstChild("Right Arm")
local plr=game.Players:GetPlayerFromCharacter(sp.Parent)
if mh and eh and eh~=mh and mh.Health>0 and eh.Health>0 and ra and plr~=nil then
if not plr.Neutral then
local eplr=game.Players:GetPlayerFromCharacter(eh.Parent)
if eplr~=nil and eplr.Neutral==false and eplr.TeamColor==plr.TeamColor then
return --No team killing
end
end
ready=false
for i,v in ipairs(eh:GetChildren()) do
if v.Name=="creator" then
v:remove()
end
end
local creator=Instance.new("ObjectValue")
creator.Name="creator"
creator.Value=plr
creator.Parent=eh
debris:AddItem(creator,1)
local localdamage=math.floor(damage*(.9+(math.random()*.2)))
eh:TakeDamage(localdamage)
billboard(hit.Position,"-"..tostring(localdamage))
runsound(hitsounds[math.random(1,#hitsounds)])
local bloodeffects=math.ceil(localdamage/10)
for i=1,math.random(bloodeffects-1,bloodeffects+1) do
end
end
end
end)
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
18 Apr 2015 12:31 PM
bump
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
18 Apr 2015 02:54 PM
bump
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
18 Apr 2015 03:43 PM
bump
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
18 Apr 2015 04:18 PM
bump
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
19 Apr 2015 02:06 AM
bump
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
19 Apr 2015 05:48 AM
bump
Report Abuse
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
19 Apr 2015 05:53 AM
do you know what the output is and if so have you checked it for errors
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
19 Apr 2015 06:25 AM
Yes, there appear to be no problems regarding output. I think it is just the script which only allows you to kill other players.
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
19 Apr 2015 08:23 AM
bump
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
19 Apr 2015 08:55 AM
bump
Report Abuse
420swagyolonoscope is not online. 420swagyolonoscope
Joined: 15 Oct 2017
Total Posts: 117
19 Apr 2015 09:35 AM
Name the zombie AI model "Zombie" don't change the name of the humanoid in the script or the model. Then you want to add this function:

dmg = 1032039282438723

script.Parent.Touched:connect(function(hit)
if hit.Parent.Name == "Zombie" then
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - dmg
end
end)



--kthxbye



--kthxbye
Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
20 Apr 2015 11:49 AM
Bump. Sorry, but the zombies have a health/name tag.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
20 Apr 2015 11:52 AM
Nobody has time for modifying free models for somebody else sorry dude.
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
20 Apr 2015 11:55 AM
local eh=hit.Parent:FindFirstChild("Zombie")
There would have to be an object in the Zombies called "Zombie"

Put prints in each part of the .Touched event

sp.Handle.Touched:connect(function(hit)
if ready and equipped and hit and hit.Parent~=nil and hit:IsDescendantOf(sp.Parent)==false and string.lower(string.sub(hit.Name,1,6))~="effect" and (tick()-lastswing)<=damagewindow then
print("Can run first if statement")
end
end)

^ ect

Report Abuse
SimplyRemove is not online. SimplyRemove
Joined: 24 Nov 2012
Total Posts: 4387
20 Apr 2015 12:15 PM
Which part do I put that in?
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
20 Apr 2015 12:38 PM
You put it across the entire .Touched event..
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image