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: I am Stuck on this Script

Previous Thread :: Next Thread 
CustardCream95 is not online. CustardCream95
Joined: 16 Aug 2012
Total Posts: 579
06 May 2013 03:00 AM
I have no clue what the problem is there are no red underlined words/phrases even when I use my script assist there are no compilation errors, So I am asking if you could find the problem...:

Player = script.Parent.Parent
Mouse = Player:GetMouse()

function onKeyDown(key)
Key = key:lower()
if key == "z" then
x = Instance.new("Part")
x.BrickColor = BrickColor.new("Bright Red")
x.Size = Vector3.new(10, 10, 10)
x.Transparency = 0.6
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.Shape = "Ball"
y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.velocity = Player.Character.Torso.CFrame.lookVector*80
x.Parent = Workspace
y.Parent= x
f = Instance.new("Fire", x)
f.Size = 12
f.heat = 0
game.Debris:AddItem(x, 6)
x.CFrame = Player.Character.Torso*CFrame.new(0, 0, -14)
end
end

Mouse.KeyDown:connect(onKeyDown)
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
06 May 2013 03:12 AM
Hm, I don't really see what could be wrong...

But you're using 'if key == "z" then', where I assume you would use... wait:

------------------------------------
local Key = key:lower() -- use local tag to avoid storing old keys. Whatever... they are overwritten.

if Key == "s" then
------------------------------------

So yeah... that, and "f.heat = 0" << Sure it's lowercase h? Haven't checked it.

- As, local As = _G.GetAs()
Report Abuse
CustardCream95 is not online. CustardCream95
Joined: 16 Aug 2012
Total Posts: 579
06 May 2013 03:15 AM
Thanks Random upside down dude :P
Report Abuse
CustardCream95 is not online. CustardCream95
Joined: 16 Aug 2012
Total Posts: 579
06 May 2013 03:19 AM
I used wait but my Script Assist told me to put a then on line 7 where then I thought "then"'s go on the line of the conditional or the line that you are wanting someting t happen after so I put it on line 6 and it works and its Upper-case "h" in heat just checked thanks for the help.! :)
Report Abuse
CustardCream95 is not online. CustardCream95
Joined: 16 Aug 2012
Total Posts: 579
06 May 2013 03:33 AM
Would I be needing a hopperbin as I have been watching a youtube tuto and I created this but I get nothing... If I need a hooperbin where do I put it in the script?
Script again:

Player = script.Parent.Parent
Mouse = Player:GetMouse()

function onKeyDown(key)
local Key = key:lower()
if key == "z" then
x = Instance.new("Part")
x.BrickColor = BrickColor.new("Bright Red")
x.Size = Vector3.new(10, 10, 10)
x.Transparency = 0.6
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.Shape = "Ball"
y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.velocity = Player.Character.Torso.CFrame.lookVector*80
x.Parent = Workspace
y.Parent= x
f = Instance.new("Fire", x)
f.Size = 12
f.Heat = 0
game.Debris:AddItem(x, 6)
x.CFrame = Player.Character.Torso*CFrame.new(0, 0, -14)
end
end

Mouse.KeyDown:connect(onKeyDown)
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
06 May 2013 04:02 AM
No.

The :GetMouse() method was invented some months ago... maybe years...

Before that, you would need a Tool or HopperBin in order to access a player's mouse.

Still, the only limitation with :GetMouse(), that Tools or HopperBins don't have is that the :GetMouse() mouse cannot have it's Icon changed.


- As, bampowbampowBAMCHAIR! P.S., my name is As. Hello random person Custard.
Report Abuse
CustardCream95 is not online. CustardCream95
Joined: 16 Aug 2012
Total Posts: 579
06 May 2013 04:24 AM
So you don't know why it is not working?

~~Lua is like grammar, it has to be perfect~~ :P
Report Abuse
CustardCream95 is not online. CustardCream95
Joined: 16 Aug 2012
Total Posts: 579
06 May 2013 04:26 AM
Updated LocalScript:

Player = script.Parent.Parent
Mouse = Player:GetMouse()
run = game:GetService("RunService")
function onKeyDown(key)
local Key = key:lower()
if key == "z" then
x = Instance.new("Part")
x.BrickColor = BrickColor.new("Bright Red")
x.Size = Vector3.new(10, 10, 10)
x.Shape = "Ball"
x.Name = Player.Name
x.CanCollide = false
x.Transparency = 0.6
fd = Script.FireDamage:clone()
fd.Parent = x
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.velocity = Player.Character.Torso.CFrame.lookVector*80
x.Parent = Workspace
y.Parent= x
f = Instance.new("Fire", x)
f.Size = 12
f.Heat = 0
fd.Disbaled = false
game.Debris:AddItem(x, 6)
x.CFrame = Player.Character.Torso*CFrame.new(0, 0, -14)
end
end

x.Touched:connect(onDamage)
Mouse.KeyDown:connect(onKeyDown)


Script inside Called FireDamage:

function onDamage(Part)
if Part.Parent:FindFirstChild("Humanoid") ~= nil and Part.Parent.Name ~= "Script.Parent.Name"then
script.Disabled = true
for i = 1, 25 do
Part.Parent.Humanoid.Health = Part.Parent.Humaoid.Health -1
wait (0.05)
end
script:remove()
end
wait(0.25)
end

script.Parent.Touced:connect(onDamage)


and FireDamage is Disabled when the server starts until the User presses, "Z".
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
06 May 2013 04:31 AM
Uh...

I was just answering your question about why people use HopperBins in their videos...


But, I have to ask... why are you using script.Disabled = true before running the take-damage loop ect.? Try this:
-------------------------------------------------------------------------------------

function onDamage(Part)
if Part.Parent and Part.Parent:FindFirstChild("Humanoid") and Part.Parent.Name ~= Script.Parent.Name then
for i = 1, 25 do
Part.Parent.Humanoid:TakeDamage(1)
wait (0.05)
end
script:remove()
end
end

script.Parent.Touced:connect(onDamage)
-------------------------------------------------------------------------------------

- As, bzz, starting with 200 tokens.
Report Abuse
CustardCream95 is not online. CustardCream95
Joined: 16 Aug 2012
Total Posts: 579
06 May 2013 04:37 AM
It disables the script before it hits anyone else but the loop works if you get what I mean so once it hits/touches one humanoid it wont hit anyone elses
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
06 May 2013 04:38 AM
Learn about debounce, man :c


- As, DEBOUNCE ON THE WALLLLLL
Report Abuse
CustardCream95 is not online. CustardCream95
Joined: 16 Aug 2012
Total Posts: 579
06 May 2013 04:43 AM
I dont want it to hit anyone else and what does debounce do? also next reply is the Final Script and ChilScript
Report Abuse
CustardCream95 is not online. CustardCream95
Joined: 16 Aug 2012
Total Posts: 579
06 May 2013 04:45 AM
script.Parent:clone(Player.Character.Backpack) -- not sure if thats correct please correct the first 6 lines of code if it isn't --
Player = script.Parent.Parent
Mouse = Player:GetMouse()
run = game:GetService("RunService")
function onKeyDown(key)
local Key = key:lower()
if key == "z" then
x = Instance.new("Part")
x.BrickColor = BrickColor.new("Bright Red")
x.Size = Vector3.new(10, 10, 10)
x.Shape = "Ball"
x.Name = Player.Name
x.CanCollide = false
x.Transparency = 0.6
fd = Script.FireDamage:clone()
fd.Parent = x
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.velocity = Player.Character.Torso.CFrame.lookVector*80
x.Parent = Workspace
y.Parent= x
f = Instance.new("Fire", x)
f.Size = 12
f.Heat = 0
fd.Disbaled = false
game.Debris:AddItem(x, 6)
x.CFrame = Player.Character.Torso*CFrame.new(0, 0, -14)
end
end

x.Touched:connect(onDamage)
Mouse.KeyDown:connect(onKeyDown)


ChildScript(FireDamage):

function onDamage(Part)
if Part.Parent:FindFirstChild("Humanoid") ~= nil and Part.Parent.Name ~= "Script.Parent.Name"then
script.Disabled = true
f = Instnace.new("Fire", Part)
for i = 1, 25 do
f.Size = f.Size +0.25
Part.Parent.Humanoid.Health = Part.Parent.Humaoid.Health -1
wait (0.05)
end
Part.Parent.Humanoid.PlatformStand = true
f:remove()
script:remove()
end
wait(0.25)
end

script.Parent.Touced:connect(onDamage)


Any mistakes please correct them...
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
06 May 2013 07:38 AM
Uh... aha...?

-------------------------------------------------------------------------------------------------
script.Parent:clone().Parent = Player.Character.Backpack -- you want a clone of the script in the Backpack?

local Player = script.Parent.Parent
local Mouse = Player:GetMouse()
local run = game:GetService("RunService")

function onKeyDown(key)
local Key = key:lower()
if key == "z" then
local x = Instance.new("Part")
x.BrickColor = BrickColor.new("Bright Red")
x.Size = Vector3.new(10, 10, 10)
x.Shape = "Ball"
x.Name = Player.Name
x.CanCollide = false
x.Transparency = 0.6
local fd = Script.FireDamage:clone()
fd.Parent = x
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
local y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
y.Velocity = Player.Character.Torso.CFrame.lookVector*80
x.Parent = Workspace
y.Parent= x
local f = Instance.new("Fire", x)
f.Size = 12
f.Heat = 0
fd.Disbaled = false
game:service("Debris"):AddItem(x, 6)
if Player.Character:FindFirstChild("Torso") then
x.CFrame = Player.Character.Torso*CFrame.new(0, 0, -14)
end
end
end

Mouse.KeyDown:connect(onKeyDown)


-------------------------------------------------------------------------------------------------
ChildScript(FireDamage):

local deb = false -- debounce, yay!

function onDamage(Part)
if deb then
return
end
deb = true
if Part.Parent and Part.Parent:FindFirstChild("Humanoid") and Part.Parent.Name ~= Script.Parent.Name then
local f = Instance.new("Fire", Part)
for i = 1, 25 do
f.Size = 3 + i * 0.25 -- hehe :c
Part.Parent.Humanoid:TakeDamage(1) -- or i for exponential increasing damage!
wait (0.05)
end
Part.Parent.Humanoid.PlatformStand = true
script.Parent:Destroy() -- let's just kill your glowing ball.
end
deb = false
end

script.Parent.Touced:connect(onDamage)
-------------------------------------------------------------------------------------------------

Dunno if I got it all, tell me if you get any output.


- As, kzpawm! woah, fire, fire, fire, fire, fire...
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