How can I change a property of a part for the localplayer?
I have made a code when you touch a block the properties of an other part changes. It works, but everyone sees it. I want that the property only changes for the local player. Can someone help me? these are the codes I have made 2 local scripts in the startergui.
01 | local Workspace = game.Workspace |
03 | local mainpart = Workspace.Touchablewall 1 |
04 | local secondarypart = Workspace.Part 28 |
05 | local thirdpart = Workspace.Part 29 |
06 | local secondmainpart = Workspace.Touchablewall 2 |
07 | local Players = game:GetService( "Players" ) |
10 | mainpart.Touched:connect( function (hit) |
11 | if hit.Parent:FindFirstChild( "Humanoid" ) ~ = nil then |
14 | secondarypart.Transparency = 1 |
15 | secondarypart.CanCollide = false |
16 | mainpart.Transparency = 0 |
17 | thirdpart.CanCollide = true |
18 | thirdpart.Transparency = 0 |
19 | secondmainpart.Transparency = 1 |
20 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
21 | player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1 |
22 | mainpart.Transparency = 0 |
23 | secondarypart.Transparency = 1 |
24 | secondarypart.CanCollide = false |
25 | thirdpart.CanCollide = true |
26 | thirdpart.Transparency = 0 |
27 | secondmainpart.Transparency = 1 |
30 | mainpart.Transparency = 1 |
31 | secondarypart.Transparency = 0 |
32 | secondarypart.CanCollide = true |
33 | thirdpart.CanCollide = false |
34 | thirdpart.Transparency = 1 |
35 | secondmainpart.Transparency = 0 |
-----other script
01 | local Workspace = game.Workspace |
03 | local mainpart = Workspace.Touchablewall 2 |
04 | local secondarypart = Workspace.Part 29 |
05 | local thirdpart = Workspace.Part 28 |
06 | local secondmainpart = Workspace.Touchablewall 1 |
09 | mainpart.Touched:connect( function (hit) |
10 | if hit.Parent:FindFirstChild( "Humanoid" ) ~ = nil then |
13 | secondarypart.Transparency = 1 |
14 | secondarypart.CanCollide = false |
15 | mainpart.Transparency = 0 |
16 | thirdpart.CanCollide = true |
17 | thirdpart.Transparency = 0 |
18 | secondmainpart.Transparency = 1 |
19 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
20 | player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1 |
21 | mainpart.Transparency = 0 |
22 | secondarypart.Transparency = 1 |
23 | secondarypart.CanCollide = false |
24 | thirdpart.CanCollide = true |
25 | thirdpart.Transparency = 0 |
26 | secondmainpart.Transparency = 1 |
29 | mainpart.Transparency = 1 |
30 | secondarypart.Transparency = 0 |
31 | secondarypart.CanCollide = true |
32 | thirdpart.CanCollide = false |
33 | thirdpart.Transparency = 1 |
34 | secondmainpart.Transparency = 0 |