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: clickdetector local script

Previous Thread :: Next Thread 
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:32 PM
is there way to make local script detect part click?
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
11 Sep 2016 12:33 PM
yes but why tho?

same as in a server script :/
Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:33 PM
but it doesnt work for me why D:
Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:34 PM
script.Parent.ClickDetector.MouseClick:connect(function(hit)
--things
end)


^^^ wot did i do wrong D: it works on noraml script not local D:
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
11 Sep 2016 12:35 PM
script.Parent.ClickDetector.MouseClick:connect(function(hit)
--things
end)

"script.Parent"

http://wiki.roblox.com/index.php?title=API:Class/LocalScript

read the description -.-
Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:36 PM
right local script only work for the player...
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
11 Sep 2016 12:36 PM
"A LocalScript will only run Lua code if it is a descendant of one of the following objects:
A Player's Backpack, such as a child of a Tool
A Player's Character model
A Player's PlayerGui
A Player's PlayerScripts
The ReplicatedFirst service
Note: the parent of the LocalScript will determine which client the Lua code will be executed on."
Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:36 PM
so how do i make it work?????????
Report Abuse
windbeach is not online. windbeach
Joined: 11 Jul 2013
Total Posts: 293
11 Sep 2016 12:36 PM
A LocalScript will only run Lua code if it is a descendant of one of the following objects:
A Player's Backpack, such as a child of a Tool
A Player's Character model
A Player's PlayerGui
A Player's PlayerScripts
The ReplicatedFirst service


Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:37 PM
game.Name.part.clickdetector ???
Report Abuse
windbeach is not online. windbeach
Joined: 11 Jul 2013
Total Posts: 293
11 Sep 2016 12:37 PM
Use a normal script @op


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
11 Sep 2016 12:38 PM
ClickDetectors are used for parts, not guis.

--server

local part = workspace.Part

part.ClickDetector.MouseClick:connect(function(player)
print(player.Name)
end)




Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:38 PM
fock ill use a normal script sure only if roblox let me use getmouse for key down again
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
11 Sep 2016 12:39 PM
bruh, study more about lua before trying to copy and paste everything
especially if you think game.Name will get you to an instance
Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:40 PM
mfg name is an example i am done study more lua i am not those kinda of people who can learn stuff randomly i learn when i need it.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
11 Sep 2016 12:42 PM
KeyDown is deprecated. Use uis.

local uis = game:GetService('UserInputService')

uis.InputBegan:connect(function(input,event)
if event then return end
if input.KeyCode == Enum.KeyCode.X then
print('Pressing X')
end
end)

Are you asking how to select a part from local without using a click detector? Thats easy


--local

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.Button1Down:connect(function()
if mouse.Target and mouse.Target:IsA('Part') then
print(mouse.Target.Name)
end
end)


Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:45 PM
nooo here my script

it is a fail piece of crap i know



local de = false
local inuse = false
local plr = nil
local char = nil
local using = false
script.Parent.ClickDetector.MouseClick:connect(function(hit)
if inuse == false then
if de == false then
plr = hit
char = plr.Character
if char.Humanoid.Health ~= 0 then
de = true
inuse = true
wait()
char.Torso.CFrame = script.Parent.Parent.thing.CFrame

char.Torso.Anchored = true

else
plr = nil
char = nil
de = false
using = false
inuse = false
end
game.Players.PlayerRemoving:connect(function(pr)
if plr and pr.Name == plr.Name then
plr = nil
char = nil
using = false
de = false
inuse = false
end
end)


char.Humanoid.Died:connect(function(cha)
if plr and char ~= nil then
plr = nil
char = nil
de = false
using = false
inuse = false
end
end)

wait(3)
de = false
end
elseif inuse == true and de == false then
inuse = false
de = true
char.Torso.Anchored = false
plr = nil
char = nil
using = false
wait(3)
de = false
end
end)


game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.Space then
print'running'
if using == false and plr.Character.Torso.Anchored == true and plr and char then
using = true
plr:findFirstChild(script.typ.Value).Value = plr:findFirstChild(script.typ.Value).Value +1
wait(0.5)
using = false
else print'error'
end
end
end)








Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
11 Sep 2016 12:45 PM
God this is a piece of junk. What the hell are you trying to do?


Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:45 PM
i dont get the new key down roblox update >:L
Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:46 PM
its a stat training system >:(
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
11 Sep 2016 12:46 PM
hahahaha he is using so many variables for literally nothing XDDDDD
Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:47 PM
and anti bug >:(
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
11 Sep 2016 12:47 PM
okay? Give more details? How what do you want it to do?


Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:47 PM
variable is the only thing i know how to use to stop bugs >:L what else >:(
Report Abuse
trunks0817 is not online. trunks0817
Joined: 20 Jan 2016
Total Posts: 495
11 Sep 2016 12:49 PM
so its a piece of crap then there is a part where u click it cframe ur torso the the cframe of dat part when that happens it anchore ur torso then when u press space bar and it give add 1 to ur stat value then it gotta wait 0.5 second before that happens again and if u reset i want the script to not let u walking around and still be able to get stat >:L
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