Cyber6210
|
  |
| Joined: 11 Apr 2016 |
| Total Posts: 110 |
|
|
| 23 Oct 2017 10:01 AM |
So i have a button and on click it should clone the gui from ServerStorage and put it into the players PlayerGui. Does anyone know how to fix this script?
local Message1 = game.ReplicatedStorage:WaitForChild("Message1")
Message1.OnServerEvent:connect(function() game.ServerStorage.Message1:Clone().Parent = game.Players. --How do i get it in the player that clicked the button?
end)
I have a RemoteEvent in replicated storage and a local script along with a text button in a surface gui in a part in workspace but im pretty sure they work.
This is the script in ServerScriptService that needs to clone it into the player but im having difficulties getting it into the player. |
|
|
| Report Abuse |
|
|
mybowls72
|
  |
| Joined: 05 Aug 2013 |
| Total Posts: 2688 |
|
| |
|
helloburp
|
  |
| Joined: 26 Aug 2011 |
| Total Posts: 14376 |
|
|
| 23 Oct 2017 10:05 AM |
| Just start with it in the player, no need to do all this complicated stuff. |
|
|
| Report Abuse |
|
|
Cyber6210
|
  |
| Joined: 11 Apr 2016 |
| Total Posts: 110 |
|
|
| 23 Oct 2017 10:05 AM |
| No because i need it to appear only when its clicked. |
|
|
| Report Abuse |
|
|
|
| 23 Oct 2017 10:06 AM |
Message1.OnServerEvent:connect(function() local clonee = game.ServerStorage.Message1:Clone() clonee.Parent = game:GetService("Players").LocalPlayer
end) |
|
|
| Report Abuse |
|
|
|
| 23 Oct 2017 10:07 AM |
| clonee.Parent = game:GetService("Players").LocalPlayer.PlayerGui |
|
|
| Report Abuse |
|
|
|
| 23 Oct 2017 10:09 AM |
| try this and tell me if its working |
|
|
| Report Abuse |
|
|
Cyber6210
|
  |
| Joined: 11 Apr 2016 |
| Total Posts: 110 |
|
|
| 23 Oct 2017 12:05 PM |
| O yeah do i need a click detector? |
|
|
| Report Abuse |
|
|
Cyber6210
|
  |
| Joined: 11 Apr 2016 |
| Total Posts: 110 |
|
| |
|
|
| 23 Oct 2017 12:31 PM |
put the local script inside the textbutton and in the local script: local Message1 = game.ReplicatedStorage:WaitForChild("Message1")
script.Parent.MouseButton1Click:connect(function() Message1:FireServer() end) |
|
|
| Report Abuse |
|
|
|
| 23 Oct 2017 01:02 PM |
i made it work!! what you need is script in ServerScriptService script:
game.Players.PlayerAdded:connect(function(plr) local NewClone = game.ServerStorage.ScreenGui:Clone() NewClone.Parent = plr.PlayerGui end)
and script inside the textbutton script:
script.Parent.MouseButton1Click:connect(function() local player = game:GetService("Players").LocalPlayer player.PlayerGui.ScreenGui.Enabled = true end)
and you need to disabled the ScreenGui enjoy :p |
|
|
| Report Abuse |
|
|
Cyber6210
|
  |
| Joined: 11 Apr 2016 |
| Total Posts: 110 |
|
|
| 24 Oct 2017 03:11 AM |
Thank you! I sort of gave up and was going to try collision instead of buttons but you help! =P
|
|
|
| Report Abuse |
|
|