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: Doc's Help Thread

Previous Thread :: Next Thread 
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
08 Jul 2011 04:07 PM
I'm bored and I have nothing to do. I'll answer scripting questions to the best of my knowledge, and fix your scripts as long as they are not outrageous.

Go.
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
08 Jul 2011 04:08 PM
function onFire(gun)
local Hit, Pos = game.Workspace:FindPartOnRay(Ray.new(gun.Position, gun.CFrame.lookVector * 999))
local b = Instance.new("Part")
b.Parent = game.Workspace
b.Position = gun.Position:Lerp(Pos, 0.1)
b.formFactor = 0
b.Size = Vector3.new(1,.4,1)
b.BrickColor = BrickColor.new(194)
b.Name = "Rocket"
local bv = Instance.new("BodyVelocity")
bv.velocity = gun.CFrame.lookVector * 1000
bv.Parent = b
local s = script.Parent.Rocket:Clone()
s.Disabled = false
s.Parent = b
local M = script.Parent.Rockett:Clone()
M.Parent = b
local K = Instance.new("Smoke")
K.Parent = b
K.RiseVelocity = 10
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = script.Parent.Parent.Parent
creator_tag.Name = "creator"
creator_tag.Parent = b
end


The missile that is shot comes back from the place where it was shot from. (This is a plane missile shoot script) The plane is in the position where the missile was shot from before and is attacked by its own missile. Any way to fix it?

Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
08 Jul 2011 04:09 PM
"The missile that is shot comes back from the place where it was shot from. (This is a plane missile shoot script) The plane is in the position where the missile was shot from before and is attacked by its own missile. Any way to fix it?"

I can't understand the problem. Could you rephrase it please?
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
08 Jul 2011 04:11 PM
Ok here.
FIrst off, this is a plane misile shoot script. The missile is shot from let's say a position of 50,12,15. The missile comes backs to that position. By that time, the plane has reached that point, and the missile shoots its maker.
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
08 Jul 2011 04:13 PM
@citymaster22

So you're saying the plane runs into it's own bullet? I'm sorry, I am just really confused here.
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
08 Jul 2011 04:14 PM
Yep
Report Abuse
nightmare3o is not online. nightmare3o
Joined: 21 Jun 2008
Total Posts: 956
08 Jul 2011 04:14 PM
could you view my thread? its the mine thread
Report Abuse
nightmare3o is not online. nightmare3o
Joined: 21 Jun 2008
Total Posts: 956
08 Jul 2011 04:15 PM
print("Nights MineScript")


toolneeded = { "Pickaxe" }
Rock = script.Parent

function mineScript(name)
for i = 1,#toolneeded do

if (string.upper(name) == string.upper(toolneeded[i])) then return true end
end
return false
end

function onTouched(hit)
print("Rock Hit")
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil ) then
game.Lighting.MagicOre:clone().Parent = player.Backpack
end
end

end

connection = Rock.Touched:connect(onTouched)

When the pickaxe touches the rock it gives the player a Ore
Thats all if you need more info just tell me
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
08 Jul 2011 04:17 PM
@citymaster22

Ok if I am understanding right, the plane is moving too fast so it runs into it's own bullet, or something like that. Increasing the distance from the plane when the bullet is spawned, as well as increasing the missile speed should work. Try this out.

function onFire(gun)
local Hit, Pos = game.Workspace:FindPartOnRay(Ray.new(gun.Position, gun.CFrame.lookVector * 999))
local b = Instance.new("Part")
b.Parent = game.Workspace
b.Position = gun.Position:Lerp(Pos, 0.25)
b.formFactor = 0
b.Size = Vector3.new(1,.4,1)
b.BrickColor = BrickColor.new(194)
b.Name = "Rocket"
local bv = Instance.new("BodyVelocity")
bv.velocity = gun.Velocity + gun.CFrame.lookVector * 100
bv.Parent = b
local s = script.Parent.Rocket:Clone()
s.Disabled = false
s.Parent = b
local M = script.Parent.Rockett:Clone()
M.Parent = b
local K = Instance.new("Smoke")
K.Parent = b
K.RiseVelocity = 10
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = script.Parent.Parent.Parent
creator_tag.Name = "creator"
creator_tag.Parent = b
end
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
08 Jul 2011 04:18 PM
"When the pickaxe touches the rock it gives the player a Ore
Thats all if you need more info just tell me"

Is that what it does, or what it is supposed to do? Is there any information in the output?
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
08 Jul 2011 04:19 PM
@DR
No, the CFrame glitch causes the missile to be teleported back where it was shot from.
Report Abuse
nightmare3o is not online. nightmare3o
Joined: 21 Jun 2008
Total Posts: 956
08 Jul 2011 04:20 PM
thats what its suppsoed to do sorry.
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
08 Jul 2011 04:20 PM
@city

CFrame glitch? What have I missed?
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
08 Jul 2011 04:21 PM
A lot. It causes the object CFramed to be CFramed back to the position it was CFrame from.
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
08 Jul 2011 04:23 PM
@night

Well the problem is, you're doing this:

local human = hit.Parent:findFirstChild("Humanoid")

Which would check for a humanoid inside the tool, which doesn't exist. You need to check for the humanoid inside the character, which would be something like...

localhuman = hit.Parent.Parent:findFirstChild("Humanoid")
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
08 Jul 2011 04:24 PM
"A lot. It causes the object CFramed to be CFramed back to the position it was CFrame from."

Well I can't fix Roblox glitches. Sorry I couldn't help :|
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
08 Jul 2011 04:24 PM
Lawl, but what about using the OffSet property of BlockMesh to simulate the movement?
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
08 Jul 2011 04:26 PM
@city

Simulate the movement? If you did that, how would you detect collisions with enemies? You couldn't blow stuff up really
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
08 Jul 2011 04:27 PM
But once it had touched the enemy, it would move the brick to that position, and then boom
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
08 Jul 2011 04:28 PM
But the BlockMesh doesn't have a .Touched event. It would be near impossible (but totally impractical anyways) to detect collisions with a mesh.
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
08 Jul 2011 04:28 PM
Nothing happens when I click, and the mouse icon doesn't change, BUT I only get output AFTER I click :-/

Output: Players.Player.Backpack.Bomb.Script:6: attempt to index local 'mouse' (a nil value)


local tool = script.Parent
local plant = false
local money = 7

tool.Activated:connect(function(mouse)
mouse.Icon = "rbxasset://textures\\GunCursor.png" --Line 6
mouse.Button1Down:connect(function()
if plant == true then return end
plant = true
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
bomb = Instance.new("Part",workspace)
bomb.Name = "Bomb"
bomb.Reflectance = 1
bomb.Shape = "Ball"
bomb.Size = Vector3.new(2,2,2)
bomb.Position = tool.Parent.Head.Position
wait(3)
exp = Instance.new("Explosion",bomb)
exp.Name = "Bewm :3"
exp.BlastRadius = 20
exp.BlastPressure = 1000000
exp.Position = exp.Parent.Position
exp.Hit:connect(function(part)
ghosts = 0
if part.Parent.Name == "Ghost" then
ghosts = ghosts + 1
part.Parent:BreakJoints()
player = game.Players:GetPlayerFromCharacter(tool.Parent)
stats = player:findFirstChild("leaderstats")
cash = stats:findFirstChild("Cash")
if cash then
cash.Value = cash.Value + money*ghosts
bomb:remove()
end end end)
wait(3)
plant = false
mouse.Icon = "rbxasset://textures\\GunCursor.png"
end) end)

Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
08 Jul 2011 04:29 PM
So how the heck does crazyman32 do it?
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
08 Jul 2011 04:30 PM
@2above

tool.Equipped:connect(function(mouse)
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
08 Jul 2011 04:32 PM
@pomp

Is that in a tool or hopperbin, and a script or localscript?

@city

He doesn't use mainstream free-model planes. :D
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
08 Jul 2011 04:33 PM
@Dr
I'm using his starterkit. And he told me that's the way he did it. He used RayCast to detect what it hit, used OffSet to simulate the movement of the missile and then blew it up using the actual missile by moving it :P
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