Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I seperate the player names?

I'm trying to make a teleport script which allows me to type /e appa/playername/playername but at the moment I can only only teleport the speaker to the person called.. Could someone help me please?

local isAdmin = {[14946581] = true, [28433911] = true, [17008190] = true}


A = script.Effect.A
B = script.Effect.B
C = script.Effect.C
D = script.Effect.D
E = A:Clone()
F = B:Clone()
G = C:Clone()
H = D:Clone()
 

function findPlayer(name)
    for _,v in pairs(game.Players:GetChildren()) do
        if string.lower(string.sub(v.Name, 1, #name)) == string.lower(name) then
            return v
        end
    end
end


 
function onChatted(message, player)
    if message:sub(1, 8):lower() == ("/e Appa/"):lower()and isAdmin[player.UserId] then
    for _, child in pairs(player.Character:GetChildren()) do
 		if child:IsA("BasePart") then
    		spawn(function()
				victim = findPlayer(message:sub(9))
				if victim and victim.Character then
					
					local E2 = E:Clone()
					local F2 = F:Clone()
					local G2 = G:Clone()
					local H2 = H:Clone()
					
				    E2.Parent = child
				    F2.Parent = child
				    G2.Parent = child
				    H2.Parent = child
				    
				    wait(.5)
				    
				    player.Character.HumanoidRootPart.CFrame = (CFrame.new(victim.Character.Head.Position))
				    wait(1)
				    E2:Remove()
				    F2:Remove()
				    G2:Remove()
				    H2:Remove()
				        
				      
					end
				end)
            end
        end
    end
end
 
 
game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(message) onChatted(message, player) end)
end)

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.