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: Outside damage?!

Previous Thread :: Next Thread 
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
01 Feb 2012 11:44 PM
So im working on this vampire script (wich is turning out great!). but im not stuck with a problom of if im outside when the sun is out, i will burn and get damaged. i know how to script and all but i dont know how to do this part! i tryed making it so if i touch nothing this action will do, but its imposible. if anyone know how to do that please exsplain me to me, i dont ask for scripts but i need help!
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 12:07 AM
i tryed this, not outpot and no resolts :c

function burn(hit)
if hit == nil then
Instance.new("Fire", script.Parent)
end
end
script.Parent.Touched:connect(burn)
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
02 Feb 2012 12:36 AM
why did you use "if hit == nil then"?
hit is never nil it will always return a object value, use "if hit then" instead
Report Abuse
soccaboy17 is not online. soccaboy17
Joined: 22 Sep 2009
Total Posts: 3161
02 Feb 2012 12:38 AM
Well, if you are just checking if it is hit then..even the sheer fact that the script was fired, shows that it was touched..
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 12:41 AM
So how can i make it that when you in the sun (meaning you uper body ist touching anything 'torso') fire will come out
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 01:08 AM
i tryed this one...but it just give me fire even if i hit the part :(
anyhelp?~

local pm = game.Workspace:GetChildren()
for _,v in pairs(pm) do
if v:IsA("Part") then
local magna = v.Position
function look()
local positions = (script.Parent.Position - magna).Magnitude
if positions ~= 3 then
Instance.new("Fire", script.Parent)
end
end
end
end
look()
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
02 Feb 2012 01:13 AM
script.Parent.Touched:connect(function(hit)
--if game.Players:GetPlayerFromCharacter(hit.Parent) then
Instance.new("Fire",hit)
--end
end

?
remove the commented lines if you want this only to apply for parts of characters

­<'+1 Post. Ujelly?'>
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 01:16 AM
Sorry it wont work :L
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
02 Feb 2012 01:17 AM
script.Parent.Touched:connect(function(hit)
--if game.Players:GetPlayerFromCharacter(hit.Parent) then
Instance.new("Fire",hit)
--end
end)

­<'+1 Post. Ujelly?'>
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 01:18 AM
still not working :'(
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
02 Feb 2012 01:19 AM
Is it in a script that is inside a part?

­<'+1 Post. Ujelly?'>
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 01:21 AM
Yap, Davidii was able to make it so when you go outside durring raint attack you will get damage (unless you inside). its exstrmly complicated script :(
hopfully we can figher this out.
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 01:30 AM
I FIGER IT OUT!!! :DDDDD

local pm = game.Workspace:GetChildren()
for _,v in pairs(pm) do
if v:IsA("Part") then
local magna = v
function look()
local positions = (script.Parent.Position - magna.Position).magnitude
if positions > 3 then
Instance.new("Fire", script.Parent)
end
end
end
end
look()
Report Abuse
NINJAKID09 is not online. NINJAKID09
Joined: 27 Aug 2009
Total Posts: 14392
02 Feb 2012 03:36 AM
You can use raycasting to check if there's a part above you.

hence 'in the sun' or not.
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 10:21 AM
how we do that then?
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
02 Feb 2012 10:28 AM
Here's how I (basically) did it in a game I started a while back.

while wait(1) do
   for _,player in pairs(game.Players:GetPlayers()) do
      local part,_ = game.Workspace:FindPartOnRay(Ray.new(player.Character.Head.Position,       lighting:GetSunDirection()*999), player.Character)
      if not part then
         player.Character.Humanoid:TakeDamage(1)
      end
   end
end

"It looks nice, but I sense a disturbing lack of Rainbow Dash and Fluttershy."
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 10:33 AM
Can you exsplain me how to do it, its cainda comfusing me on what you did
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 10:43 AM
i just looked over the wiki, will this work?

while true do
wait()
local day = game.Lightning.TimeOfDay > "10:00:00" and game.Lightning.TimeOfDay < "18:00:00"
if day == true then
local sun = Ray.new(game.Lightning:GetSunDuraction(), script.Parent.Position)
local sunz, end = game.Workspace:FindPartOnRay(sun)
if sunz.ClassName ~= "Part" then
Instance.new("Fire", script.Parent.Paremt.Torso)
end
end
end
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 10:48 AM
I fix more stuff in stodio but i get this out put
>16:30:48 - ClassName is not a valid member
16:30:48 - Script "Workspace.Player.Head.Script", Line 7
16:30:48 - stack end

while true do
wait()
local day = game.Lighting.TimeOfDay > "10:00:00" and game.Lighting.TimeOfDay < "18:00:00"
if day == true then
local sun = Ray.new(game.Lighting:GetSunDirection()*1000, script.Parent.Position)
local sunz, ending = game.Workspace:FindPartOnRay(sun)
if ending.ClassName ~= "Part" then
Instance.new("Fire", script.Parent.Paremt.Torso)
end
end
end
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
02 Feb 2012 11:14 AM
Oh, that's what you wanted.. one second..

    game.Players.PlayerAdded:connect(function(plr)
        plr.CharacterAdded:connect(function(char)
            while wait(1) do
                pcall(function()
                    local ray=Ray.new(char.Head.Position,game.Lighting:GetSunDirection()*75)
                    local hit=workspace:FindPartOnRay(ray,char.Head)
                    if not hit then
                        char.Humanoid:TakeDamage(10)
                        Instance.new("Fire",char.Torso)
                    end
                end
            end)
        end)
    end)

­<'+1 Post. Ujelly?'>
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
02 Feb 2012 11:15 AM
Fuu, put the parenthesis on the wrong end.

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
while wait(1) do
pcall(function()
local ray=Ray.new(char.Head.Position,game.Lighting:GetSunDirection()*75)
local hit=workspace:FindPartOnRay(ray,char.Head)
if not hit then
char.Humanoid:TakeDamage(10)
Instance.new("Fire",char.Torso)
end
end)
end
end)
end)

­<'+1 Post. Ujelly?'>
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 11:21 AM
what about this?! when its not hitting its remove the fire :(

while true do
wait()
for i,v in pairs(script.Parent.Parent:GetChildren()) do
if v:IsA("Part") then
local burn = v
local sun = Ray.new(game.Lighting:GetSunDirection()*1000,burn.Position)
local endpart = game.Workspace:FindPartOnRay(sun,script.Parent)
if not ending then
if script.Parent.Parent.Torso:findFirstChild("Fire") == nil then
Instance.new("Fire", script.Parent.Parent.Torso)
elseif ending then
if script.Parent.Parent.Torso:findFirstChild("Fire") ~= nil then
script.Parent.Parent.Torso:findFirstChild("Fire"):Remove()
end
end
end
end
end
end
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
02 Feb 2012 11:24 AM
use mine

­<'+1 Post. Ujelly?'>
Report Abuse
TheWhiteAngle is not online. TheWhiteAngle
Joined: 31 Dec 2011
Total Posts: 435
02 Feb 2012 11:27 AM
i dont want to use other people script i want to learn and make it my own, my work perfectly...but when im under a part it wont remove my fire...please help me fix it.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
02 Feb 2012 11:33 AM
Hm, try this out

    game.Players.PlayerAdded:connect(function(plr)
        plr.CharacterAdded:connect(function(char)
            while wait(1) do
                pcall(function()
                    local ray=Ray.new(char.Head.Position,game.Lighting:GetSunDirection()*75)
                    local hit=workspace:FindPartOnRay(ray,char.Head)
                    if not char.Torso:FindFirstChild("Fire") then
                        if not hit then
                            local fire=Instance.new("Fire",char.Torso)
                            game.Debris:AddItem(fire,10)
                        end
                    else
                        char.Humanoid:TakeDamage(2.5)
                    end
                end)
            end
        end)
    end)

Learn from it and try to make it on your own, if that's what you're wanting

­<'+1 Post. Ujelly?'>
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