|
| 05 Jul 2012 09:19 AM |
SO I have this hit marker script that is supposed to give a GUI to the person who is shooting at the person being shot at, but it won't work:
script.Parent.Touched:connect(function(p) pl = game.Players:GetPlayerFromCharacter(script.Parent.[ObjectValue].Value) if p.Parent:FindFirstChild("Humanoid") and pl then game.Lighting.HitMarker:clone().Parent = pl.PlayerGui end end) |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 05 Jul 2012 09:29 AM |
| Wait what, why are you even using an ObjectValue? |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2012 09:37 AM |
Just put the hitmarker in the weapon script itself.
If you're using raycast, then check if the ray hit something, and if it is a player, then make the hitmarkers show.
☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞ - Candymaniac, a highly reactive substance. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2012 03:50 PM |
| But it is getting the GUI from Lighting.. |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Jul 2012 06:37 PM |
script.Parent.Touched:connect(function(p) pl = game.Players:GetPlayerFromCharacter(script.Parent[ObjectValue].Value) if p.Parent:FindFirstChild("Humanoid") and pl then game.Lighting.HitMarker:clone().Parent = pl.PlayerGui end end)
With brackets You don't have a dot before Them, only after. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2012 07:08 PM |
| Ok now how would I clone an ObjectValue into the bullet? |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2012 07:09 PM |
q = script.Parent.ObjectValue:clone() q.Parent = bullet q.Value = script.Parent.ObjectValue.Value
? |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2012 07:31 PM |
Is this right?
ball = script.Parent damage = math.random(40,40) local hitt = false local forsurenexttime = false
HitSound = Instance.new("Sound") HitSound.Name = "HitSound" HitSound.SoundId = "http://www.roblox.com/asset/?id=11945266" HitSound.Pitch = .8 HitSound.Volume = 1 HitSound.Parent = ball
q = script.Parent.ObjectValue:clone() --------------------would this work? Or is it in the wrong spot? q.Parent = bullet q.Value = script.Parent.ObjectValue.Value
function onTouched(hit) if hitt == false and hit.Parent.className ~= "Hat" and hit.Parent.className ~= "Tool" and hit.CanCollide ~= false and hit.Name ~= "Flag" and hit.Name ~= "Floosh" and hit.Name ~= "Shell" then hitt = true local humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid == nil and hit.BrickColor ~= BrickColor.new("Medium stone grey") and hit.Transparency < .1 then local floosh = Instance.new("Part") local mesh = Instance.new("SpecialMesh") mesh.MeshType = "Sphere" floosh.Name = "Floosh" floosh.Size = Vector3.new(1,1,1) mesh.Scale = Vector3.new(1,3,1) mesh.Parent = floosh floosh.Parent = game.Workspace floosh.BrickColor = hit.BrickColor floosh.CFrame = ball.CFrame floosh.CanCollide = false floosh.Velocity = Vector3.new(0,50,0) game:getService("Debris"):addItem(floosh,.1) end
if hit.Name == "Barrel" then hit.Velocity = script.Parent.Velocity / 6 return end
if math.random(1,3) == 2 or math.random(1,3) == 3 and forsurenexttime == false then hitt = false damage = damage - 10 print("Penentrated") end
if humanoid ~= nil then tagHumanoid(humanoid) if hit.Name == "Head" then humanoid:TakeDamage(damage * 3) elseif hit.Name == "Torso" then humanoid:TakeDamage(damage * 1) else humanoid:TakeDamage(damage) end wait() untagHumanoid(humanoid) end
end if hitt == true then connection:disconnect() ball:remove() end end
function tagHumanoid(humanoid) -- todo: make tag expire local tag = ball:findFirstChild("creator") if tag ~= nil then local new_tag = tag:clone() new_tag.Parent = humanoid end end
function untagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") if tag ~= nil then tag.Parent = nil end end end
connection = ball.Touched:connect(onTouched)
wait(8) ball.Parent = nil
|
|
|
| Report Abuse |
|
|
|
| 14 Jul 2012 07:38 PM |
| "bullet" is undefined, and I saw "math.random(40,40)" why not just put 40? |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2012 07:40 PM |
| Bullet is defined in a different script and I dont know about the bullet 40,40 I got lazy. And is the script right otherwise? |
|
|
| Report Abuse |
|
|