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

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

Asked by 5 years ago

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)
0
Note: This is not a full script, this is a part of settings script of Kohls infinite admin MaciBoss1950 16 — 5y
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.  Ziffixture 6913 — 5y
0
I want to put people who touch the pad get moderator MaciBoss1950 16 — 5y
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 WyattagumsBackUp 5 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
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.

0
It doesn't work still... It's the same problem again MaciBoss1950 16 — 5y
Ad

Answer this question