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

Part Touched = Print("..player.Name..")?

Hey there, Heads up i'm super new to scripting

I've been trying to create a simple script for the past 1 hour and 30mins now, Trying to make it when a player touches a Part it prints there Player name along with a message in output,

I've tried all the functions and events i could find via Youtube and the wiki that seem to make sense but it doesn't seem to work

Thanks,

2 answers

✓ Accepted answer
game.Workspace.TextChangePart.Touched:Connect(function(hit)
	script.Parent.Text = hit.parent.name .. " has touched the part"
end)

Put inside the text label Change "TextChangePart" to your part name.

9 comments

0

Dang.. i was making it harder for myself, Thanks alot man!, If you don't mind were would i go from here instead of making it print in output i would want it as a TextLabel on a gui?

0

Try that.

0

I get this error: StarterGUI is not a valid member of DataModel. Were should i put the Screen Gui inside?

0

Switched to a Local Script and it fixed the error however text still isn't changing.

0

That should fix it also keep it localscript.

0

Worked thanks alot man for all the help, much appreciated! :)

0

Hey man sorry to bug you again something just started happening randomly now and again it sometimes says Workspace found the Key! instead of player anything i can do to stop that?

0

Did you put an extra .Parent?

0

also change game.Workspace to workspace as its less indexing so it runs faster

Try this:

local part = script.Parent
debounce = false
part.Touched:connect(function(hit)
if not debounce then
debounce = true
if hit.Parent:findFirstChild("Humanoid") then
print(hit.Parent.Name .. " has touched the brick!")
end
wait(.5)
debounce = false
end
end)

Sorry if it's a little compact I wanna make it work as best as it can.

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