|
| 11 Sep 2016 12:32 PM |
| is there way to make local script detect part click? |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:33 PM |
yes but why tho?
same as in a server script :/ |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:33 PM |
| but it doesnt work for me why D: |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 11 Sep 2016 12:36 PM |
| right local script only work for the player... |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 11 Sep 2016 12:36 PM |
| so how do i make it work????????? |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 11 Sep 2016 12:37 PM |
| game.Name.part.clickdetector ??? |
|
|
| Report Abuse |
|
|
windbeach
|
  |
| Joined: 11 Jul 2013 |
| Total Posts: 293 |
|
| |
|
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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 11 Sep 2016 12:45 PM |
| i dont get the new key down roblox update >:L |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:46 PM |
| its a stat training system >:( |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:46 PM |
| hahahaha he is using so many variables for literally nothing XDDDDD |
|
|
| Report Abuse |
|
|
| |
|
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 |
|
|
|
| 11 Sep 2016 12:47 PM |
| variable is the only thing i know how to use to stop bugs >:L what else >:( |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|