|
| 25 Jul 2012 04:19 PM |
Where would I change the position of the projectile in the script?
-- 42672473 is sorry sound -- 42672581 is wind-knocked-out sound
ball = script.Parent damage = 10
HitSound = Instance.new("Sound") HitSound.Name = "HitSound" HitSound.SoundId = "http://www.roblox.com/asset/?id=11945266" HitSound.Parent = ball HitSound.Volume = 1
PersonHitSound = Instance.new("Sound") PersonHitSound.Name = "PersonHitSound" PersonHitSound.SoundId = "http://www.roblox.com/asset/?id=42672473" --PersonHitSound.SoundId = "http://www.roblox.com/asset/?id=42672581" -- grunt sound PersonHitSound.Volume = .5 PersonHitSound.Pitch = 1 PersonHitSound.Parent = ball
function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid ~= nil then tagHumanoid(humanoid) humanoid:TakeDamage(damage) untagHumanoid(humanoid)
soundSelector = math.random()*100 PersonHitSound:Play() ball.Parent = nil else HitSound:Play() 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(5) --ball.SparkSound.Looped = false --ball.SparkSound:Stop() ball.Parent = nil |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2012 04:28 PM |
| The projectile is probably positioned by a different script. This one doesn't affect the projectile until it's hit or 5 seconds has elapsed. |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2012 04:42 PM |
My bad, is this the right script?
local Tool = script.Parent;
enabled = true
--local spark = Instance.new("Sparkles") --spark.Color = Color3.new(0,1,0)
function fire(v)
local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter)
local missile = Instance.new("Part")
--spark:Clone().Parent = missile
local spawnPos = vCharacter.PrimaryPart.Position local PewPew = Tool.Handle:FindFirstChild("PewPew")
if (PewPew == nil) then PewPew = Instance.new("Sound") PewPew.Name = "PewPew" PewPew.SoundId = "http://www.roblox.com/asset/?id=26618834" PewPew.Parent = Tool.Handle PewPew.Volume = .2 PewPew.Pitch = 1.2 end
spawnPos = spawnPos + (v * 10)
missile.Position = spawnPos missile.Size = Vector3.new(.2,.2,.2) missile.Velocity = v * 750 missile.BrickColor = BrickColor.new("Lime Green") missile.Shape = 0 missile.BottomSurface = 0 missile.TopSurface = 0 missile.Name = "Spark" missile.Reflectance = .5 missile.Elasticity = 1
local force = Instance.new("BodyForce") force.force = Vector3.new(0,98,0) force.Parent = missile
local creator_tag = Instance.new("ObjectValue") creator_tag.Value = vPlayer creator_tag.Name = "creator" creator_tag.Parent = missile local new_script = script.Parent.LaserBlast:clone() new_script.Disabled = false new_script.Parent = missile
--Tool.Handle.GruntSound:Clone().Parent = missile
missile.Parent = game.Workspace
PewPew:Play() -- wait(.15) --PewPew:Stop() end
function gunUp() Tool.GripForward = Vector3.new(0,.981,-.196) Tool.GripRight = Vector3.new(1,0,0) Tool.GripUp = Vector3.new(0,.196,.981) end
function gunOut() Tool.GripForward = Vector3.new(0,1,0) Tool.GripRight = Vector3.new(1,0,0) Tool.GripUp = Vector3.new(0,0,1) end
function isTurbo(character) return character:FindFirstChild("BoltHelm") ~= nil end
function onActivated() if not enabled then return end
enabled = false
local character = Tool.Parent; local humanoid = character.Humanoid if humanoid == nil then print("Humanoid not found") return end
local targetPos = humanoid.TargetPoint local lookAt = (targetPos - character.Head.Position).unit
local reload = .1 --if (isTurbo(character)) then -- reload = .25 -- print("turbo") --end
gunUp() fire(lookAt) wait(reload) gunOut() wait(reload)
enabled = true
end
function onEquipped() --Tool.Handle.EquipSound:play() end
script.Parent.Activated:connect(onActivated) script.Parent.Equipped:connect(onEquipped)
|
|
|
| Report Abuse |
|
|
|
| 25 Jul 2012 04:45 PM |
"local spawnPos = vCharacter.PrimaryPart.Position
local PewPew = Tool.Handle:FindFirstChild("PewPew")
if (PewPew == nil) then PewPew = Instance.new("Sound") PewPew.Name = "PewPew" PewPew.SoundId = "http://www.roblox.com/asset/?id=26618834" PewPew.Parent = Tool.Handle PewPew.Volume = .2 PewPew.Pitch = 1.2 end
spawnPos = spawnPos + (v * 10)"
You would change the following two lines: local spawnPos = vCharacter.PrimaryPart.Position -- This is the character's head, if you aren't aware spawnPos = spawnPos + (v * 10) |
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Jul 2012 04:57 PM |
| What would I change the "primarypart" to if I wanted the right arm? |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2012 04:58 PM |
| local spawnPos = vCharacter["Right Arm"].Position |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2012 05:08 PM |
| Changing the spawn position to the right arm broke the script, I guess I'll keep the position at the head. |
|
|
| Report Abuse |
|
|