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)
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)
###The problem with, your script is, you’re trying to modify a 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.
-- LocalScript under StarterGui/PlayerGui
local remote = game.Workspace.RemoteEvent
-- I recommend under ReplicatedStorage, but this is an example
remote.OnClientEvent:Connect(function()
-- :Connect not :connect, :connect is deprecated
script.Parent.ScreenGui.ScrollingFrame.BackgroundTransparency = 1
end)
###Server code:
function onTouch(part)
local plr = game:GetService("Players"):GetPlayerFromCharacter(part.Parent)
if plr then
game.Workspace.RemoteEvent:FireClient(plr)
end
end
script.Parent.Touched:Connect(onTouch)
-- Again, :Connect, not :connect
lol i just realized when i did this i put "Local function" XD
8 months later
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You're editing the StarterGui not the Player's Gui, so edits aren't being shown to you. I can elaborate further if you want me to.