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

how to make part that if person clicked it part is only invisible to person who clicked it?

Asked by 2 years ago

i want to make game like cheese escape someone help pls

0
Use local scripts. Easy! T3_MasterGamer 2189 — 2y
0
i tried teshowypl 15 — 2y
0
I think i see your problem, if your using clickdetectors it doesn't work on the client, let me write a response to make a better way Littlebigplanet40000 77 — 2y
0
ok i solved it cuz i used local script in workspace XD teshowypl 15 — 2y

2 answers

Log in to vote
0
Answered by 2 years ago

Use local scripts. Local scripts make things happen only to the client (you). This is an example when you click a ClickDetector.

ClickDetector.MouseClick:Connect(function(Player)
   Part.Transparency = 1
end)

This should work. Otherwise it could either be you did it wrong or it’s another error from a different script that’s causing it not to work.

0
I don't think click detectors work on the client Littlebigplanet40000 77 — 2y
0
or maybe it does, wait let me check Littlebigplanet40000 77 — 2y
Ad
Log in to vote
0
Answered by 2 years ago

Ok so use a local script and put something similar to this (make sure to put it in startercharacterscripts)

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local part = game.Workspace.Cheese -- Set this to whatever your part is

mouse.Button1Down:Connect(function()
    if mouse.Target == part then
        --You can do whatever you want here just using transparency as an example
        if part.Transparency ~= 1 then -- just making sure the code doesn't unnecessarily run more than once
            part.Transparency = 0.5

        end

    end
end)

You could swap out using mouse for using raycasts if you want Hope this helps!

Answer this question