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 » Scripting Helpers
Home Search
 

Re: ObjectValue Problem

Previous Thread :: Next Thread 
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
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 is not online. 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
Candymaniac is not online. Candymaniac
Joined: 08 Oct 2009
Total Posts: 8985
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
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
05 Jul 2012 03:50 PM
But it is getting the GUI from Lighting..
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
14 Jul 2012 06:22 PM
Bump
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
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
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
14 Jul 2012 07:08 PM
Ok now how would I clone an ObjectValue into the bullet?
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
14 Jul 2012 07:09 PM
q = script.Parent.ObjectValue:clone()
q.Parent = bullet
q.Value = script.Parent.ObjectValue.Value


?
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
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
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
14 Jul 2012 07:38 PM
"bullet" is undefined, and I saw "math.random(40,40)" why not just put 40?
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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