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

How would I make it so this script happens after an event has played?

Asked by 10 years ago

names = {"Alpha","Bravo","Gama","Kilo","Papa","Zulu","November","Yankee"}

function handout() for i,v in pairs(game.Players:GetChildren()) do if workspace:FindFirstChild(v.Name) then c = BrickColor.Random() local b = Instance.new("BillboardGui",workspace[v.Name].Head) b.Size =UDim2.new(6,0,2,0) b.StudsOffset = Vector3.new(0,1.5,0) local text = Instance.new("TextLabel",b) text.Size = UDim2.new(1,0,1,0) text.Text = names[math.random(1,#names)] text.TextColor3 = c.Color text.TextScaled = true text.BackgroundTransparency = 1 for t,k in pairs(workspace[v.Name]:GetChildren()) do if k:IsA("Part") and k.Name ~= "HumanoidRootPart" then if k.Name == "Torso" then k.BrickColor = c else k.BrickColor = BrickColor.new("Medium stone grey") end elseif k:IsA("Shirt") or k:IsA("Pants") then k:Destroy() elseif k:IsA("Hat") then if k:FindFirstChild("Handle") then k.Handle:Destroy() end elseif k:IsA("CharacterMesh") then k:Destroy() end end end end end

for i = 10,0,-1 do wait(.7) print(i) end

handout()

How would I that happen when something happens, like when players are teleported, or so?

0
Can you put it into a code block? ultrabug 306 — 10y
0
What`s that, (imma noob.?) stanford7787 0 — 10y

1 answer

Log in to vote
0
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
10 years ago

Just a example; if I knew what specific event you had in mind then I'd post it.

--This script will execute whenever a value named "TeleportPlayersToField" changes.
names = {"Alpha","Bravo","Gama","Kilo","Papa","Zulu","November","Yankee"}

function handout(x)
for i,v in pairs(game.Players:GetChildren()) do
if workspace:FindFirstChild(v.Name) then
c = BrickColor.Random()
local b = Instance.new("BillboardGui",workspace[v.Name].Head)
b.Size =UDim2.new(6,0,2,0)
b.StudsOffset = Vector3.new(0,1.5,0)
local text = Instance.new("TextLabel",b)
text.Size = UDim2.new(1,0,1,0)
text.Text = names[math.random(1,#names)]
text.TextColor3 = c.Color text.TextScaled = true
text.BackgroundTransparency = 1
for t,k in pairs(workspace[v.Name]:GetChildren()) do
if k:IsA("Part") and k.Name ~= "HumanoidRootPart" then
if k.Name == "Torso" then
k.BrickColor = c
else
k.BrickColor = BrickColor.new("Medium stone grey")
end
elseif k:IsA("Shirt") or k:IsA("Pants") then
k:Destroy() elseif k:IsA("Hat") then
if k:FindFirstChild("Handle") then
k.Handle:Destroy()
end
elseif k:IsA("CharacterMesh") then
k:Destroy()
end
end
end
end
end

for i = 10,0,-1 do wait(.7) print(i) end

game.ServerStorage.TeleportPlayersToField:connect(handout)

Can you put it into a code block?

There is a Lua icon button in the editor panel, then you can paste the code in the space.

The teleported event you were talking about is meant for if a player is teleported to another place, like for Sword Fighting On The Hieghts, to Murder Mystery.

0
What i meant for teleportation is when players teleport to a certain map, or so to say. stanford7787 0 — 10y
Ad

Answer this question