So When I step on the part it does print yes and yet it doesn't change the transparency?
local function onTouch(hit) game.StarterGui.ScreenGui.ScrollingFrame.BackgroundTransparency = 1 print("yes") end script.Parent.Touched:connect(onTouch)
GuiObject
on the server. You don’t use StarterGui
, you use PlayerGui
. You can’t modify PlayerGui
from the server either. Use a RemoteEvent
to do this.01 | -- LocalScript under StarterGui/PlayerGui |
02 |
03 | local remote = game.Workspace.RemoteEvent |
04 | -- I recommend under ReplicatedStorage, but this is an example |
05 |
06 | remote.OnClientEvent:Connect( function () |
07 | -- :Connect not :connect, :connect is deprecated |
08 |
09 | script.Parent.ScreenGui.ScrollingFrame.BackgroundTransparency = 1 |
10 | end ) |
01 | function onTouch(part) |
02 | local plr = game:GetService( "Players" ):GetPlayerFromCharacter(part.Parent) |
03 |
04 | if plr then |
05 | game.Workspace.RemoteEvent:FireClient(plr) |
06 | end |
07 | end |
08 |
09 | script.Parent.Touched:Connect(onTouch) |
10 | -- Again, :Connect, not :connect |