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: Script give On Touch?

Previous Thread :: Next Thread 
YourStoneMaster is not online. YourStoneMaster
Joined: 29 Mar 2013
Total Posts: 401
07 May 2014 10:05 PM
I need a script where it gives out a local script in a part when a player touches the part.
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
07 May 2014 10:08 PM
Use onTouched function and then clone the script, and then add an 'end' to end the function and then connect the function.
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
07 May 2014 11:01 PM
function touched(Object)
if Game.Players:GetPlayerFromCharacter(Object.Parent) and (not bounce) then
bounce = true
local plr = Game.Players:GetPlayerFromCharacter(Object.Parent)
for i, plr in pairs(Game.Players:GetPlayers()) do
local ls = Instance.new("LocalScript")
ls.Parent = plr.Character
end
end
end
bounce = false
script.Parent.Touched:connect(touched)
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
07 May 2014 11:02 PM
Put that in a brick ^
Report Abuse
ChosenDreamer is not online. ChosenDreamer
Joined: 23 Oct 2013
Total Posts: 15580
07 May 2014 11:38 PM
That won't work pretty sure.
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
07 May 2014 11:49 PM
I've used this method plenty of times. If you think it won't work, make your own. Geez. The f did you come from? You're not even a good scripting helper.
Report Abuse
Yushida is not online. Yushida
Joined: 19 Oct 2012
Total Posts: 210
07 May 2014 11:51 PM
local debounce = false
script.Parent.Touched:connect(function(part)
local human = part.Parent:FindFirstChild("Humanoid")
if (human ~= nil) and not debounce then
debounce = true
local player = Game.Players:GetPlayerFromCharacter(part.Parent)
if player ~= nil and not player.PlayerGui:FindFirstChild("GuiX") then
script.Parent.GuiX:Clone().Parent = player.PlayerGui
end
wait(2)
debounce = false
end
end)
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