Why isn't the script working?

I don’t think you even understand how remote events work. Please do a research about it first.

I do know it sends a signal to the server but idk what do u need that here if u just need to change attributes locally

God this is so confusing- but yea putting it on StarterPlayer folder doesn’t work… I think I will try the remote event thing somehow

The thing is, local scripts never work in workspace.

They do for the player thay are in

A LocalScript will only run Lua code if it is a descendant of one of the following objects:

  • A Player’s Backpack , such as a child of a Tool
  • A Player’s character model
  • A Player’s PlayerGui
  • A Player’s PlayerScripts .
  • The ReplicatedFirst service
2 Likes

Okay look, do you want the part to be transparent for only the player or the whole server?

Thank you, finally someone that can correct this man.

I think she wants it to be transparent for the player
Not the whole server

I want the part to be transparent and the collision turned of for the player that clicked 1 option

Am I asking you? No right? Do not answer it if you’re aren’t the OP.

Use remote events

U don’t need remote events for that

Okay, then you have 2 options.

The easier way is put that script in somewhere locally, maybe replicated first or StarterPlayerScripts. Then, you correct the path of the variables inside it.

The hard way is to use a sever script, a remote even and a local script. The server script will give out a signal through the remote event and the local script will do the job.

1 Like

That would need to be a RemoteEvent, using a Server Script doesn’t always mean that it will execute for everyone. For example, ProximityPrompts only work with a server script as far as I’m concerned.

You’ve misunderstood their topic. They want it ONLY the client, not the whole server.

Instead of using server sided scripts, you can use remote events
Or put the script on replicated first or starter gui.

local a = script.Parent.A
local b = script.Parent.B

a.MouseButton1Click:Connect(function()
a:Destroy()
b:Destroy()

This is an example ^^

Also, you could use developerHub

Ah, my apologies. I won’t confuse anyone then.

It is not working because local scripts do not work in the workspace. You could change it to a script, but I understand you don’t want anyone else in the server to also see the changes, so you should just move your local script to StarterPlayerScripts or StarterGui

Now that your script is actually running since you moved it, you will get an error saying that “SheAre” - (or SheIs) - “is not a valid member of SurfaceGui” so you would simply change the first two lines to this

local SheIs = game.Workspace.Prova1.SurfaceGui:FindFirstChild("SheIs")
local SheAre = game.Workspace.Prova1.SurfaceGui:FindFirstChild("SheAre")

FindFirstChild returns nil if it can’t find it, rather than erroring the script.
you can read more about FindFirstChild here: Instance | Roblox Creator Documentation

I hope this works for you!

That’s the script Im using now:

local SheIs = game.Workspace.Prova1.SurfaceGui.SheIs
local SheAre = game.Workspace.Prova1.SurfaceGui.SheAre
local Prova1 = game.Workspace.Prova1

SheIs.MouseButton1Click:Connect(function()
	Prova1.Transparency = 0.5
	Prova1.CanCollide = false
end)
SheAre.MouseButton1Click:Connect(function()
	SheAre.BackgroundColor3 = Color3.fromRBG (239, 78, 78)
end)

I put it in StarterPlayerScripts and now its a script but nothing changes when I click (and there are no errors), I think I will try to fix it tomorrow or something. Thanks btw.

1 Like