Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i fix my GUI to appear for only the clicker?

So, I am trying to make a dialog GUI its supposed to only appear for the player who clicks the torso of the dummy but instead it does it for all players and i cant use local player and, I have tried quite a few things but it doesn't even give me a error if you could help me out then thank you

game.Players.PlayerAdded:Connect(function(plr)
local CommLog = Instance.new("ScreenGui")
local Text = Instance.new("Frame")
local wow = Instance.new("TextLabel")

local function onClicked()
workspace.Dummy.Torso.ClickDetector.MaxActivationDistance = 0
game.Players.name.Character.Humanoid.WalkSpeed = 0
Text.Visible = true
wow.Text = "H"   
wait(0.30)
wow.Text = "Hi"
wait(4)
Text.Visible = false
wow.Text = ""
plr.Character.Humanoid.WalkSpeed = 16
workspace.Dummy.Torso.ClickDetector.MaxActivationDistance = 32
end

  game.Workspace.Dummy.Torso.ClickDetector.MouseClick:connect(onClicked)
end)

5 comments

0

Use a LocalScript to do the GUI coding. Server shouldn't be doing this for any reason.

0

i have tried moving and editing it to a LocalScript it didnt even appear

0

There are many things wrong with this script. A few things being that it should be in a LocalScript, you didn't parent the ScreenGui, Frame, or TextLabel to anything, you used "name" instead of "Name", and you used "connect" instead of "Connect". Fixing these most likely wouldn't completely fix your problem, but you should fix them to get somewhat closer to a solution.

0

Unfortunately I cannot look into this further right now as I have to leave, but if you haven't solved your problem by the morning I will be happy to try to solve the problem then.

0

@incapaz, he needs a remote event. He needs Client for GUI Handling, and the Server for the MouseClick event stuff.

1 answer

✓ Accepted answer

RemoteEvent Time! Make a 2 RemoteEvents in Rep. and name them "Event1" and "Event2" Server Script:

game.Players.PlayerAdded:Connect(function(player)
local Event = game:GetService("ReplicatedStorage").Event
local Event2 = game:GetService("ReplicatedStorage").Event2
game.Workspace.Dummy.Torso.ClickDetector.MouseClick:Connect(function()
game.Workspace.Dummy.Torso.ClickDetector.MaxActivationDistance = 0
Event:FireClient(player)
end)
Event2.OnServerEvent:Connect(function()
game.Workspace.Dummy.Torso.ClickDetector.MaxActivationDistance = 32
end)
end)

Client Script:

game:GetService("ReplicatedStorage").Event.OnClientEvent:Connect(function()
local CommLog = Instance.new("ScreenGui")
CommLog.Name = "CommLog"
CommLog.Parent = game.Players.LocalPlayer.PlayerGui
local Text = Instance.new("Frame", CommLog)
Text.Name = "Text"
Text.Visible = false
local wow = Instance.new("TextLabel", Text)
wow.Name = "wow"


game.Players.LocalPlayer.Humanoid.WalkSpeed = 0
Text.Visible = true
wow.Text = "H"
wait(.3)
wow.Text = "Hi"
wait(4)
Text.Visible = false
wow.Text = ""
game.Players.LocalPlayer.Humanoid.WalkSpeed = 16
game:GetService("ReplicatedStorage").Event2:FireServer()
end
end)

Try this. If it doesn't work or u dont understand, then leave a comment. Im going to bed now.

15 comments

0

Sorry about me not explaining much, im just tired. If you don't know what I mean by Server and Client, then oof let me explain. the Server Script you paste in a Script in ServerScriptService. The Client Script, you paste in a local script in StarterGui. In this, when I say "Rep". I mean replicated storage.

0

LocalPlayer is nil on the server

0

lemme fix dat

0

there we go :D

0

it gives me a error saying FireClient: player argument must be a player object

0

ummm @incapaz help

0

R u using the updated script?

0

It should work tho lolxdd

0

ik it should..

0

im dying from me dealing with this gui all day ;-;

0

I recently edited the script, try the edit.

0

Ugh do u have discord?

0

yes xd

0

Name?

0

sent

This discussion is preserved as it was. New answers, comments, and votes are closed.