If you see here,
game.Workspace.Room.Door.Stuff.Touched:connect() script.Parent.Visible = true wait(1) local tweenservice = game:GetService("TweenService") local fadebackground = script.Parent --background local tweenInfo = TweenInfo.new( 3,--time Enum.EasingStyle.Sine, --smooth Enum.EasingDirection.Out, --dont change 0, -- dont change true, --false = fade out true = fade in 0 ) local tween = tweenservice:Create(fadebackground, tweenInfo, {BackgroundTransparency = 1}) tween:Play() end) end)
It just won't run. If anyone could help, that would be greatly appreciated. I just don't know what's wrong. If you have questions or need more information, just reply.
Thanks!!
Ah, it is actually good practice to not mix .Touched and a guitype's property together.
If you want to do this, I suggest getting more familar with RemoteEvents and Server to client and client to server capabilities. I would suggest learning those before attempting this, however, for the purpose of your question, I'll get down to explaining a fix.
For starters, insert a "RemoteEvent," into ReplicatedStorage, for the sake of this answer/little tutorial of mine, I may tweak the set up that I use to fit your specifications, as the set up I always use is one remote event and one remote function per game.
Name the remoteevent anything you want, I'll just keep it simple and go off, "Event," make sure your Event is in ReplicatedStorage though.
Now, let's start with the server side.
But before that, I want to state this is not the only method to set this up, you don't need a remote event, you could easily clone to the playergui and then the localscript will automatically run the code.
To the coding for the server side.
workspace.Room.Door.Stuff.Touched:connect(function(hit) -- "workspace" is the same as game.Workspace, just shorter, either works however you see fit though. local player = game.Players:FindFirstChild(hit.Parent) if player then -- This sets it up so it checks if the part that touched the, "Stuff," in door is indeed a player. game.ReplicatedStorage.Event:FireClient(player) end end)
-- This will fire to, "player," which will automatically get the player that touched the part, one thing to learn is, both OnServerEvent which gets the server side of a FireServer() and FireClient() which fires from the server to the client, the first argument is ALWAYS the player, so for example. If I wanted to FireClient() to someone who joined a game just then, I'd only need to get the variable, or the default argument the PlayerAdded event gives us, same goes for the touched event. As long as the player argument is defined, it will fire to the SPECIFIC client in the first parameter, which is the player argument.
To the local side, you will want to create a localscript, anywhere is fine, but for the sake of making it simple, I'll put it in the frame that you are trying to change to visible.
local TweenService = game:GetService("TweenService") -- I suggest keeping this out of the event. Always put Services like these up at the top of the script. local fadeBackground = script.Parent -- Once again, keep these up here. You could easily of set this to visible without needing to just define script.Parent again if you put this at the top of the script. game.ReplicatedStorage.Event.OnClientEvent:Connect(function() `script.Parent.Visible = true local tweenInfo = ( 3, Enum.EasingSty le.Sine, Enum.EasingDirection.Out, 0, false, 0 ) local tween = TweenService:Create(fadedBackground,tweenInfo,{BackgroundTransparency = 1}) tween:Play() end)
I didn't go to in-depth on how you can possibly make a better fade gui, however, that is up to you to decide. I have shown you the a better way of creating a fading gui, as yours just won't work regardless in all honesty, you'd have to use Filtering Enabled to the extent it won't break, and you can't set a frame to false from a server script, and it's best to keep .Touched on server(I haven't tested it out on client, but I just know it'd be best to develop it on server, never felt the obligation to see it on client) So there you have it, I hope you enjoyed my extremely long tutorial.