I don’t know what the GUI is, but you might. If they use the code you have rn, it does work, but it fires for all clients. If this was like a brick that when invisible, gives an award, you might only want the person clicking it, to get it. More context is needed, Although if they want all clients to get it, this change is easily done by instead of :FireClient() with :FireAllClients(), so for my example I used a remote event, but if they want all clients then sure it doesn’t need one, but its just easier to explain when both options are available
You don’t need RemoteEvents for this.
Let the server script change the Part’s transparency, then the client can wait for that Part to change transparency. There doesn’t have to be any communication.
So my best option is to have my clickdetector script in serverscriptservice and the ui code in screengui which is under startergui?
My question to you is this.
If player A and Player B are in a server and Player A clicks it. Who do you want it to show to?
Player A? Or Both Player A and Player B
1 player per server, so player A.
Oh nice. Then yes you can use @DiamondDrencher1 Method above to achieve this result if you don’t want to use remote events.
I’m still confused, but this is what I did and it doesn’t work.
local Orbz = game:GetService("Workspace"):WaitForChild("Orbz")
local object = script.Parent
local clickdetector = workspace.Orbz.ClickDetector
clickdetector.MouseClick:Connect(function(player)
if player then
local char = player.Character or player.CharacterAdded:Wait()
local tool = player.Backpack:FindFirstChildWhichIsA("Tool")
local at = game:GetService("Workspace"):WaitForChild("ar")
print(tool.Name)
if tool and tool.Name == "ToolA" then
script.Parent.Transparency = 0.1
at.BrickColor = BrickColor.new("Hot pink")
tool:Destroy()
end
end
end)
Yes. And your local script has what code in it?
local orb = game.Workspace:FindFirstChild("Orbz")
local frame = game.StarterGui.ScreenGui.Frame
orb:GetPropertyChangedSignal("Transparency"):Connect(function()
if orb and orb:IsA("Part") then
if orb.Transparency == 0.1 then
frame.Visible = true
else
frame.Visible = false
end
else
frame.Visible = false
end
end)
local Orbz = game:GetService("Workspace"):WaitForChild("Orbz")
local object = script.Parent
local clickdetector = workspace.Orbz.ClickDetector
clickdetector.MouseClick:Connect(function(player)
if player then
local char = player.Character or player.CharacterAdded:Wait()
local tool = player.Backpack:FindFirstChildWhichIsA("Tool")
local at = game:GetService("Workspace"):WaitForChild("ar")
print(tool.Name)
if tool and tool.Name == "ToolA" then
script.Parent.Transparency = 0.1 -- Should be Orbz.Transparency = 0.1
at.BrickColor = BrickColor.new("Hot pink")
tool:Destroy()
end
end
end)
Issue is with script.Parent.Transparency = 0.1
when I think it should be Orbz.Transparency = 0.1
Transparency is not a valid member of ServerScriptService “ServerScriptService” is the error I got
Yes because what you were doing is doing Script.Parent to a script inside ServerScriptService, and not mentioning the part you want to be transparent in workspace