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: A little help

Previous Thread :: Next Thread 
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
07 Dec 2015 07:41 AM
Im trying to make a dodgeball that youre able to pickup using its clickdetector, but once its picked up, the click detector is parented to nil and the dodgeball will be by your hand. Using getmouse, you click using button1down to release the dodgeball, then I disconnect the button1down event. It aint working properly, im pretty confused as to how the outline would look like. Heres my draft:


local ball = script.Parent -- Ball
local cd = script.Parent.ClickDetector
local owner = script.Parent.Owner -- StringValue
local click = 0

cd.MouseClick:connect(function(plyr)
if (click == 0) then
owner.Value = plyr.Name
cd.Parent = nil
print(click)
click = click + 1
print(click)
elseif (click == 1) then
local mouse = plyr:GetMouse()
local con con = mouse.Button1Down:connect(function()
print('fire')
click = 0
cd.Parent = ball
con:disconnect()
end)
end
end)


Problem, it never print 'fire.'
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
07 Dec 2015 07:41 PM
Bump
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
07 Dec 2015 07:47 PM
I know you'd have to click the click detector again to activate the second part of code, but I'm confused as to how I can activate the Button1Down event without clicking the click detector more than once.
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
07 Dec 2015 08:19 PM
Bump.

Also I'm trying to get it in this order:

Click click detector
Click detector is nil
Value changes to clickers name
(Imaginary for now) ball will be held by player
GetMouse is used to make the player use the Button1Down event
Player clicks once, (imaginary) ball is released
Click detector is parented back to ball
Button1Down is disconnected
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
07 Dec 2015 08:37 PM
You can not get a player's input using a server script (i.e GetMouse() and UserInputService)



#code Instance.new("BodyThrust",SenseiWarrior).position = CFrame.new(SenseiWarrior,YourGirlsDMs)
Report Abuse
wackeyhd5cool is not online. wackeyhd5cool
Joined: 24 Nov 2010
Total Posts: 906
07 Dec 2015 09:00 PM
I don't know if this is your problem but try not having two word variables like con con
Report Abuse
hkep is not online. hkep
Joined: 19 Jul 2014
Total Posts: 550
07 Dec 2015 09:45 PM
local ball = script.Parent -- Ball
local cd = ball.ClickDetector -- id change this to Instance.new;
local owner = ball.Owner -- StringValue
local click = 0

cd.MouseClick:connect(function(plyr)
if (click == 0) then
owner.Value = plyr.Name
cd:Destroy(); -- just destroy it, this script will run again when it enters workspace
cd = nil;
print(click)
click = click + 1
print(click)
elseif (click == 1) then -- this whole section is crap because this a global script. You need to make a local script and put it in every client, and use player.CharacterAdded:connect(function(C)C.ChildAdded:connect(function(Child)
local mouse = plyr:GetMouse()
local con con = mouse.Button1Down:connect(function()
print('fire')
click = 0
cd.Parent = ball
con:disconnect()
end)
end
end)
Report Abuse
hkep is not online. hkep
Joined: 19 Jul 2014
Total Posts: 550
07 Dec 2015 09:46 PM
Second thought, it might not run again when it enters workspace. But the client script can make it run again.
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