Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help With A Touched Script?

Asked by
Scootakip 299 Moderation Voter
9 years ago
01s = script.Parent.Parent.Head
02w = script.Parent.Parent
03local r = script.Parent
04local players = game:GetService("Players")
05 
06r.Touched:connect(function(part)
07    local player = part and part.Parent and players:GetPlayerFromCharacter(part.Parent)
08    if player then
09    local humanoid = part.Parent:FindFirstChild("Humanoid").Parent
10    if humanoid.Name == "Scootakip" then
11        w.Name = "Lolyeh"
12        s.BrickColor = BrickColor.new("Really blue")
13        wait(5)
14        w.Name = "Find Out If You're Scootakip"
15        s.BrickColor = BrickColor.new("White")
View all 26 lines...

This script works fine the way it is, but I need help changing it. Right now if you step on it, something activates and then goes back to normal 3 seconds after, but what I want is that it stays activated as long as the player is on the brick, and deactivates as soon as they step off. Can someone either tell me how to do that or give me a link to a page that will tell me how to do it?

1
The TouchEnded event works, but it tends to do weird things if multiple people are on the brick, so I'd probably end up using magnitude. Perci1 4988 — 9y

Answer this question