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: onTouch scripts

Previous Thread :: Next Thread 
Ninjo100 is not online. Ninjo100
Joined: 26 Mar 2011
Total Posts: 86
27 Apr 2013 01:54 AM
Does anyone have any interesting onTouch scripts.
Report Abuse
Bloxyhead is not online. Bloxyhead
Joined: 12 Oct 2009
Total Posts: 52
27 Apr 2013 02:27 AM
hm

function onTouched(part)
part.Parent.Name = "i like bloxyhead"
end

workspace.part.Touched:connect(onTouched)
Report Abuse
Ninjo100 is not online. Ninjo100
Joined: 26 Mar 2011
Total Posts: 86
27 Apr 2013 02:36 AM
Cool, anymore anyone
Report Abuse
stephen1182 is not online. stephen1182
Joined: 31 Aug 2010
Total Posts: 4003
27 Apr 2013 02:49 AM
function t(p)
a = p.Parent:findFirstChild("Humanoid")
if a ~= nil then
a.Health = 0
end
end
game.Workspace.YOURNAME.Touched:connect(t)
Report Abuse
Wreckerbuster67 is not online. Wreckerbuster67
Joined: 29 Jul 2012
Total Posts: 1144
27 Apr 2013 04:23 AM
SIM=game.Lighting.Simulation

function OnTouch()
SIM.Parent=Workspace
end
end

Place some sort of Holographic image in Lighting and name it Simulation.

Report Abuse
OKevinO is not online. OKevinO
Joined: 05 May 2010
Total Posts: 1036
27 Apr 2013 05:05 AM
hold on, ill make you one quick, youl like it
Report Abuse
Superspeed500 is not online. Superspeed500
Joined: 22 Oct 2009
Total Posts: 452
27 Apr 2013 05:10 AM
From my "Handicap button":

-- Superspeed500
-- Please edit setting in the settings folder.
-- There are two modes. NORMAL nad DEBUG

Part = script.Parent
Part.BrickColor = Part.Settings.NotTriggered.Value
debounce = false

if Part.Settings.Mode.Value == "DEBUG" then
print("Handicap brick loaded in debug mode!")

end

function OnTouch(hit)
if Part.Settings.Mode.Value == "DEBUG" or Part.Settings.Mode.Value == "NORMAL" then
Hit = hit.Parent

if debounce == true then return end
debounce = true

if Part.Settings.Mode.Value == "DEBUG" then
print("Activated")
end

if Hit:FindFirstChild("Humanoid") ~= nil then

if Part.Settings.Mode.Value == "DEBUG" then
print("Humanoid touched!")
end

if Hit:FindFirstChild("Right Arm") ~= nil then
Hit:FindFirstChild("Right Arm"):remove()
elseif hit.Parent:FindFirstChild("Left Arm") ~= nil then
Hit:FindFirstChild("Left Arm"):remove()

elseif Hit:FindFirstChild("Left Leg") ~= nil then
Hit:FindFirstChild("Left Leg"):remove()

elseif Hit:FindFirstChild("Right Leg") ~= nil then
Hit:FindFirstChild("Right Leg"):remove()


else
Hit:FindFirstChild("Humanoid").Health = 0

end

end

Part.BrickColor = script.Parent.Settings.Triggered.Value
wait(Part.Settings.Cooldown.Value)
Part.BrickColor = script.Parent.Settings.NotTriggered.Value

if Part.Settings.Mode.Value == "DEBUG" then
print("Retriggable")
end

debounce = false


else
print("ERROR: No mode selected! Deactivating!")
script.Disabled = true

end

end

Part.Touched:connect(OnTouch)
Report Abuse
OKevinO is not online. OKevinO
Joined: 05 May 2010
Total Posts: 1036
27 Apr 2013 05:29 AM
ok i finally finished it.

NOTE!: Put the script INSIDE the brick, leave the brick in "Workspace" and NAME it "Button". you have to name it button to make it work. So here it is:

debounce = false

script.Parent.Touched:connect(function(hit)
if debounce == false then
debounce = true
for i = 1, 10 do
script.Parent.Transparency = script.Parent.Transparency +0.1
wait(0.01) --Works better and seems a little smoother than wait()
end
s = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)
f = Instance.new("Frame", s)
f.Transparency = 1
f.BackgroundColor3 = Color3.new(0, 0 ,0)
wait(0.3)
f.Size = UDim2.new(1, 0, 1, 0)
for i = 1, 5 do
f.Transparency = f.Transparency -0.1
wait(0.01)
end
a = Instance.new("TextLabel", f)
a.Size = UDim2.new(1, 0, 1, 0)
a.BackgroundTransparency = 1
a.TextTransparency = 1
a.TextScaled = true
a.TextColor3 = Color3.new(234, 255, 0)
a.Text = "You cant see the brick D:"
wait(0.3)
for i = 1, 10 do
a.TextTransparency = a.TextTransparency -0.1
wait(0.01)
end
wait(3)
for i = 1, 10 do
a.TextTransparency = a.TextTransparency +0.1
wait(0.01)
end
a.Text = "But all you gotta do is click this button!"
for i = 1, 10 do
a.TextTransparency = a.TextTransparency -0.1
wait(0.01)
end
m = Instance.new("TextButton", f)
m.Size = UDim2.new(0.3, 0, 0.1, 0)
m.Position = UDim2.new(-0.300000012, 0, 0.600000024, 0)
m.BackgroundTransparency = 0.5
m.TextScaled = true
m.Text = "Click Me!"
wait(0.3)
m:TweenPosition(UDim2.new(0.350000024, 0, 0.600000024, 0), "Out", "Quad", 1.5)
m.MouseButton1Down:connect(function()
for i = 1, 10 do
game.Workspace.Button.Transparency = game.Workspace.Button.Transparency -0.1
a.TextTransparency = a.TextTransparency +0.1
wait(0.01)
end
a.Text = "Ahh, there it is :D"
for i = 1, 10 do
a.TextTransparency = a.TextTransparency -0.1
wait(0.01)
end
wait(1)
for i = 1, 10 do
f.BackgroundTransparency = f.BackgroundTransparency +0.1
a.TextTransparency = a.TextTransparency +0.1
m.TextTransparency = m.TextTransparency +0.1
m.BackgroundTransparency = m.BackgroundTransparency +0.1
wait(0.01)
end
s:Remove()
end)
debounce = false
end
end)
Report Abuse
Ninjo100 is not online. Ninjo100
Joined: 26 Mar 2011
Total Posts: 86
27 Apr 2013 06:11 AM
@Kevin, awesome script.
Report Abuse
expressmyself is not online. expressmyself
Joined: 19 Apr 2011
Total Posts: 1768
27 Apr 2013 07:33 AM
function onTouch(hit)
damage = hit.Parent:findFirstChild("Humanoid")
if damage ~= nil then
damage:TakeDamage(damage.MaxHealth)
text = hit.Parent:findFirstChild("Humanoid")
if text ~= nil then
p = Instance.new("Hint", game.StarterGui)
p.Text = "You stepped on a lego D:"
wait(2)
p:remove()
end
end
end

game.Workspace.Lego.Touched:connect(onTouch)
Report Abuse
A8P is not online. A8P
Joined: 17 Apr 2013
Total Posts: 230
27 Apr 2013 07:36 AM
a = Instance.new("Brick",game.Workspace)
a.Touched:connect(function(hit)
hit:Destroy()
end)
Report Abuse
PRESTIGIOUSaLEGEND is not online. PRESTIGIOUSaLEGEND
Joined: 16 Apr 2011
Total Posts: 1765
27 Apr 2013 08:48 AM
put in a brick --

script.Parent.Touched:connect(function()
for i,v in pairs(game.Players:GetPlayers()) do
acer = i:findFirstChild("Humanoid")
if acer ~= nil then
acer.Health = 1
msg = Instance.new("Message")
msg.Text = "You are almost dead, dont worry you will survive"
msg.Parent = Workspace
wait(3)
acer.Health = 0
msg.Text = "JKS"
print("This Script Probably Doesnt Work Because I Made It!")
end
end
end)
Report Abuse
expressmyself is not online. expressmyself
Joined: 19 Apr 2011
Total Posts: 1768
27 Apr 2013 09:01 AM
Why is the connection at the top?
Report Abuse
coolikevin22 is not online. coolikevin22
Joined: 21 Feb 2011
Total Posts: 450
27 Apr 2013 09:03 AM
script.Parent.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local msg = Instance.new("Message",workspace)
msg.Text = "Lol you are doomed for requesting on forum"
for i = 5,0 -1 do
msg.text = "Bai bai in "..i
wait(1)
end
player.Character:Destroy()
end
end)


~ Make the simple, amazing ~
Report Abuse
OKevinO is not online. OKevinO
Joined: 05 May 2010
Total Posts: 1036
02 May 2013 12:05 AM
@ninjo
thanks :)
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