#2 things

1 messages · Page 1 of 1 (latest)

dense tartan
#

1 how would i locate a player in a local or regular script
2 how would i make a function that happens when a part gets touched by a specific part?

any help would be loved

frail wraith
#

you mean like how to reference a player or get a player value?

#

and 2. use .Touched event, sometimes some objects like model dont have .Touched so just beware of that

#

and then when you use .Touched, you'll get "otherpart" as the parameter value

#

the other part is what touched the part

dense tartan
#

but lets say i want object A to execute a function if ONLY object C touches it

hardy cargo
dense tartan
#

like this??

hardy cargo
#

Ig but it's a sword maybe u want that it only detects the part that touched it when you swing?

dense tartan
#

sure

#

also the code doesnt print anything

hardy cargo
#

Don't do game.Starterpack its not the tool that the player is holding, it's just a copy of it

dense tartan
#

oh

hardy cargo
#

So maybe do

local plr = game.Players.LocalPlayer
local tool = plr.Character:WaitForChild("Tool") -- the equipped tool
local sword = tool:WaitForChild("Handle")
local block = workspace:WaitForChild("Block")

sword.Touched:Connect(function(hit)
if hit == block then
print("Don't touch that dial!")
end
end)

dense tartan
#

let me try

#

YAY

gleaming rainBOT
#

studio** You are now Level 1! **studio

dense tartan
#

it works

frail wraith
#

congrat

frail wraith
#

but that only works if you have the reference of the object