How to make it so the proprieties of a part change when another part is touched only for the player who touched it

The title say it all, im not sure how to make it so a part’s proprieties (color, material, etc) change only for the person who touched a separate part that triggers the event.

1 Like

You can use a touched event on the part, and run the other part with a bindable event, however, with a local script. Or you can run the part that needs to be touched through a server script, then run the other script for the other part on a local script with a remote event.

I’d recommend reading up on .Touched, Remote events, Local Scripts and bindable events, they will put you on the right track.

Then you can change the properties through that.

A general script though is,

--// First local script
local bindableevent = --// event
local part = --// part

part.Touched:Connect(function(hit)
if hit.Parent.Humanoid then
print("Touched!")
event:Fire()
end)

--// Second Local Script

local event = --// event
local changingPart = --// part you want changed

event.Event:Connect(function(player)
changingPart.Material = --// material
changingPart.BrickColor = BrickColor.new(--//Color)
end)

That above is a really basic way of doing what you want.

1 Like

[oops you wanted to change a different part not the touched one]

Make a local script. The best place is probably ReplicatedFirst. Have a remote event in ReplicatedStorage.

When the part is touched, have a serverscript do something like

eventname:FireClient(player)

player needs to be the actual player, not the character. There’s a function to get the player, i think it’s called :GetPlayerFromCharacter(charactermodel)

Or just search the game.Players for someone with same name as the character model/humanoid

Then in the localscript:

part = whereveritis
eventname.OnClientEvent:Connect(function()
part.PropertyYouWantToChange = newthingy
end)

changing part properties from a local script only changes it for you

Apologies for little lazy answer, you need more halp just ask

1 Like

what do i put at local bindableevent = --// event and local event = --// event? also where do i put the local scripts? sorry i just dont really know scripting

You put the Local Scripts inside the parts, and the event can be stored in replicatedstorage, just make sure you get the right event.

local RS = game:GetService("ReplicatedStorage")
local event = RS.eventName --// replace eventname with the name of the event.

This is very doable in a local script in the player’s backpack or playergui with the line

part.Touched:Connect(function(hit)
if hit.Parent == game.Players.LocalPlayer.Character then
-- change properties
end
end)

if I’m not misreading what you are trying to do

He wanted 1 part to activate it, and the other part being the one being changed. So I would imagine the easiest way is using 2 local scripts on each part with a bindable event

you could receive the touch event on for one of the parts in a local script and change the color of another part in the same local script

local Part1 = -- Part
local Part2 = -- Part2

Part1.Touched:Connect(function(hit)
     if hit.Parent == game.Players.LocalPlayer.Character then
          Part2.Color = Color3.new(255,0,0)
     end
end)

unless I’m still misunderstanding something

1 Like

Yeah, that seems to be a better idea actually.