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 » Scripters
Home Search
 

Re: Quick help?

Previous Thread :: Next Thread 
Rit957 is not online. Rit957
Joined: 19 Apr 2011
Total Posts: 3459
10 Jan 2015 07:39 PM
I know why this doesn't work, but how would I make it work?


function onTouched(hit)
local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid")

local tool = hit.Backpack:FindFirstChild("M9");
if tool then
local clips = tool.Clips.Value
tool.Clips.Value = (clips + 1)

end
end
Report Abuse
Rit957 is not online. Rit957
Joined: 19 Apr 2011
Total Posts: 3459
10 Jan 2015 07:44 PM
bump
Report Abuse
LucasLua is not online. LucasLua
Joined: 18 Jun 2008
Total Posts: 7386
10 Jan 2015 07:49 PM
For starters whoever wrote that large line of relationship operators wasn't thinking clearly as the operators would still return hit if the Parent did not contain a Humanoid...

You also need to connect the function to some sort of event so that it can interact with the Roblox environment.


Are you looking for this line? :

script.Parent.Touched:connect(onTouched)

Report Abuse
Rit957 is not online. Rit957
Joined: 19 Apr 2011
Total Posts: 3459
10 Jan 2015 07:51 PM
i know that but i mean when i add that would it work? how would i make it work if it doesnt?
Report Abuse
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
10 Jan 2015 07:55 PM
'I know why this doesn't work, but how would I make it work?'

how does that work ._.
Report Abuse
Rit957 is not online. Rit957
Joined: 19 Apr 2011
Total Posts: 3459
10 Jan 2015 07:57 PM
I know the reason why it doesn't work, it is just I have no clue how I would fix it.
Report Abuse
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
10 Jan 2015 07:58 PM
well why doesn't it work? might help me help you
Report Abuse
Rit957 is not online. Rit957
Joined: 19 Apr 2011
Total Posts: 3459
10 Jan 2015 08:00 PM
It is because when you collide with the part, hit is game.Workspace.Rit957
I can not make it check for game.Players.Rit957.Backpack but only game.Workspace.Rit957.Backpack (which does not exist.)
Report Abuse
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
10 Jan 2015 08:40 PM
db = false

function onTouched()
local plr = game.Players.LocalPlayer

db = true
local tool = plr.Backpack:FindFirstChild("M9");
if tool then
local clips = tool.Clips
tool.clips.Value = (clips + 1)
wait(1)
db = false

end
end
Report Abuse
Rit957 is not online. Rit957
Joined: 19 Apr 2011
Total Posts: 3459
10 Jan 2015 08:51 PM
My clips still stayed the same...
Report Abuse
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
10 Jan 2015 08:54 PM
tool.clips.Value = tool.clips.Value + 1
Report Abuse
2unknown2 is not online. 2unknown2
Joined: 30 Oct 2011
Total Posts: 9351
10 Jan 2015 08:57 PM
script.Parent.Touched:connect(function(hit)
local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid")
local player = hit.Parent.Name

local tool = game.Players[player].Backpack:FindFirstChild("M9");
if tool then
local clips = tool.Clips.Value
tool.Clips.Value = tool.Clips.Value + 1

end
end)
Report Abuse
Rit957 is not online. Rit957
Joined: 19 Apr 2011
Total Posts: 3459
10 Jan 2015 08:58 PM
Still nothing......
Report Abuse
Rit957 is not online. Rit957
Joined: 19 Apr 2011
Total Posts: 3459
10 Jan 2015 09:29 PM
I changed up the code but still no progress

function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
local player = game.Players:findFirstChild(hit.Parent.Name)
if (human ~= nil) then
script.Parent:remove()
local Clips = human.Parent.M9.Clips
if (Clips~=nil) then
Clips.Value = Clips.Value + 1
print "Reloading..."
end
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
Rit957 is not online. Rit957
Joined: 19 Apr 2011
Total Posts: 3459
10 Jan 2015 09:45 PM
I got it to print reloading but the clips stay the same.
Report Abuse
Rit957 is not online. Rit957
Joined: 19 Apr 2011
Total Posts: 3459
10 Jan 2015 09:51 PM
In theory, it works now. But for some reason. A glitch is the reason it is broken. I will try inside of solo mode.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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