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

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

Asked by
Aozwel 71
4 years ago

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

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

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? Aozwel 71 — 4y
0
Try that. User#29320 0 — 4y
0
I get this error: StarterGUI is not a valid member of DataModel. Were should i put the Screen Gui inside? Aozwel 71 — 4y
0
Switched to a Local Script and it fixed the error however text still isn't changing. Aozwel 71 — 4y
View all comments (5 more)
0
That should fix it also keep it localscript. User#29320 0 — 4y
0
Worked thanks alot man for all the help, much appreciated! :) Aozwel 71 — 4y
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? Aozwel 71 — 4y
0
Did you put an extra .Parent? User#29320 0 — 4y
0
also change game.Workspace to workspace as its less indexing so it runs faster LoganboyInCO 150 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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.

Answer this question