|
| 05 Feb 2016 11:47 AM |
So I have a place with FE on, so serverscripts can't access the playergui. I used a remoteevent to change a part's transparency.
--In Serverscript local event = game.Workspace.Event event.OnServerEvent:connect(function() game.Workspace.ColorPart.Transparency = 0.5 end)
But, I want something like this:
local event = game.Workspace.Event event.OnServerEvent:connect(function() local player = script.Parent.PlayerName.Value game.Workspace:FindFirstChild(player.PlayerGui.PartName.Value).Transparency = 0.5 end)
It won't work since a serverscript can't access the client, is there any other way of doing this? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 05 Feb 2016 12:24 PM |
--ServerScript local color = game.ServerStorage:WaitForChild("Color")
color.OnServerEvent:connect(function(plr,part,val) workspace[part].Transparency = val end)
--LocalScript local player = game.Players.LocalPlayer local gui = player.PlayerGui:WaitForChild("ScreenGui") local part = gui.PartName local color = game.ServerStorage:WaitForChild("Color")
color:FireServer(part.Name, 0.5) |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 02:34 PM |
| I tried it and it won't work. Is "color" supposed to be a remoteevent in ServerStorage? And isn't it supposed to be "local part = gui.PartName.Value"? The value would be the Part's Name. |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 02:59 PM |
| It still won't work. Can anyone explain what's wrong? |
|
|
| Report Abuse |
|
|
MutigenHD
|
  |
| Joined: 28 Aug 2014 |
| Total Posts: 516 |
|
|
| 05 Feb 2016 03:17 PM |
--ServerScript
local ChangeTransparency = game.ReplicatedStorage.ChangeTransparency
ChangeTransparency:FireAllClients(0.5)
--LocalScript
local Player = game.Players.LocalPlayer local ChangeTransparency = game.ReplicatedStorage.ChangeTransparency local GuiToChangeTransparency = Player.PlayerGui.GuiToChangeTransparency
ChangeTransparency.OnClientEvent:connect(function(Transparency) GuiToChangeTransparency.Transparency = Transparency end)
|
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 03:23 PM |
local event = game.ServerStorage:WaitForChild("RemoteEvent") event.OnServerEvent:connect(plr, partName, transparency) workspace[partName].Transparency = transparency end) --Regular Script
local part = game.Workspace.Part local trans = 0.5 local event = game.ServerStorage:WaitForChild("RemoteEvent") event:FireServer(part,trans) --LocalScript |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 03:31 PM |
| I tried both and they still didn't work for some reason. |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 03:37 PM |
How about this, maybe you can improve on it? In "player.PlayerGui.ScreenGui.PartName" "PartName", is a ObjectValue if you wanted to know
--In localscript
local player = game.Players.LocalPlayer local mouse = player:GetMouse()
mouse.Move:connect(function() local part = player.PlayerGui.ScreenGui.PartName game.Workspace.TransparencyEvent:FireServer(part.Name, 0.5) end)
--In serverscript local event = game.Workspace.TransparencyEvent
event.OnServerEvent:connect(function(plr,part,val) game.workspace[part].Transparency = val end) |
|
|
| Report Abuse |
|
|
MutigenHD
|
  |
| Joined: 28 Aug 2014 |
| Total Posts: 516 |
|
|
| 05 Feb 2016 03:38 PM |
You're obviously not doing something right, what I did would've worked.
|
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 03:39 PM |
| Ohh, well I'm pretty new to scripting, but I think I did it right, or you just didn't really understood what I wanted since I didn't explain well enough? |
|
|
| Report Abuse |
|
|
MutigenHD
|
  |
| Joined: 28 Aug 2014 |
| Total Posts: 516 |
|
|
| 05 Feb 2016 03:42 PM |
I know what you wanted but what I made was a simple remote event contact all the clients and anytime you wanted to change the transparency of that certain gui just replace X inside of ":FireAllClients(X)" with the transparency that you want, obviously you have to rename the variables and create a remote event.
|
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 03:44 PM |
| hmm, Maybe later I'll just make my place opened so it would be easier to work with |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 04:00 PM |
| Here's the link to my place, hopefully this will help a bit more: http://www.roblox.com/games/256420859/Smooth-Terrain-Empty |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 04:18 PM |
| Anyone can go to the place and see what's wrong and can maybe help. It's uncopylocked. I really need the help please, I'm pretty new to scripting. |
|
|
| Report Abuse |
|
|
MutigenHD
|
  |
| Joined: 28 Aug 2014 |
| Total Posts: 516 |
|
|
| 05 Feb 2016 04:18 PM |
Try putting it as active first ...
|
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 04:19 PM |
| Ohh I didn't know it needed to be active for people to see it in edit mode. Sorry, i'll make it active. |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 04:35 PM |
| This isn't as easy as most people think. Anyone know what's wrong? It would be great if anyone would help. |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 07:07 PM |
Change the script, FireServer in the StarterGui to;
local player = game.Players.LocalPlayer local mouse = player:GetMouse()
mouse.Button1Down:connect(function() local part = player.PlayerGui.ScreenGui.PartName.Value game.Workspace.TransparencyEvent:FireServer(part.Name, 0.5) end)
Then, change the TargetName script to;
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.Idle:connect(function() local target = mouse.Target if target then script.Parent.PartName.Value = target else print("No target") end end) |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2016 08:08 PM |
| Thank you so much guys, I appreciate the help! This has helped me a lot. |
|
|
| Report Abuse |
|
|
MutigenHD
|
  |
| Joined: 28 Aug 2014 |
| Total Posts: 516 |
|
| |
|