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

How do I make a hit.Parent be typed in a string form in a touched event?

How do I put a username of a player that touched a part in a string. This is my attempt, but there is no error and it doesn't work. Btw I am working on an admin pad (kohls).

game.Workspace.AdminPad.Touched:Connect(function(hit)

local player = hit.Parent.Name

local str1 = [["]]

local Owners={} local SuperAdmins={}

local Admins={} 

local Mods={str1..player..str1} 

local VIP={} 

end)

4 comments

0

Note: This is not a full script, this is a part of settings script of Kohls infinite admin

0

I don't quite understand your goal here, could you rephrase? Side-note: you can actually retrieve the PlayerInstance through the GetPlayerFromCharacter method of the Players Service; simply pass hit.Parent as the argument. 

0

I want to put people who touch the pad get moderator

0

Make a folder for the mods with string values I can't remember what the script would be but that should get you somewhere

1 answer

game.Workspace.AdminPad.Touched:Connect(function(hit)
local player = hit.Parent:FindFirstChild("Humanoid") -- Looks for the humanoid to ensure the part was a player

if player ~= nil then -- Checks if the part was a player
player = player.Parent.Name else
return
end

local str1 = "\"" -- Escape sequence which allows the string to show up as a quotation mark '"'

local Owners={} 

local SuperAdmins={}

local Admins={}

local Mods={str1..player..str1}

local VIP={}

end)

I think this is what you were attempting to do. It places the players name in the Mods array as "PLAYERNAME". If you don't want the quotation marks, remove the str1 variable.

1 comment

0

It doesn't work still... It's the same problem again

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