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

Why does this only show a billboard gui to one player?

Ok so i have a local script that should show a billboard gui to a player who is hovering over an object:

while wait(.1) do
	if (player.Character.UpperTorso.Position - car1D.Position).magnitude < range then
		if mouse.Target then
			if mouse.Target.Name == "car1Check" then
				print(player.Name.." is in range with car1")
				replicatedStorage:WaitForChild("carGui"):Clone().Parent = car1D
			else
				if car1D:FindFirstChild("carGui") then
					car1D:FindFirstChild("carGui"):Remove()
				end
			end
		end
	else
		if car1D:FindFirstChild("carGui") then
			car1D:FindFirstChild("carGui"):Remove()
		end
	end
end

This script also removes the gui when the object is not hovered.

However this only works for the first player who hovered, they can see the gui and noone else can which is good, cause FE is enabled.

But when another player, lets call it player2 hoveres over that object, that same player2 can't see the billboard gui for some reason (and ofc noone else can cause of FE).

So basically with FE i want it to only show to that one player who is hovering but it only works for the first player who hovered.

Any help on how to fix it?

1 answer

  1. Using a constant loop is bad, try avoiding it. Try making a function, like a .Touched function. You can add a part and if the player is standing on it, then make it visible.
  2. If you have filtering enabled (FE), anything you want to show to the server will require remote events.

So here is the link to remote events: http://wiki.roblox.com/index.php?title=Remote_Events_and_Functions

Remote Events require 2 scripts, a Local script and a Server Script.

Now, I'm not going to help you create the script but I will help on how.

First, you need to add a RemoteEvent into ReplicatedStorage. Now you have to figure out a way to activate the script in the LocalScript you can try .Touched or something like that.

Next, let's get into the script;

Local Script:

local RE = game:GetService('ReplicatedStorage'):WaitForChild('RemoteEvent')
-- Other variables

game.Workspace:FindFirstChild('Part').Touched:Connect(function() -- you have to figure out how you want to activate the code.
	RE:FireServer() -- this fires a signal to a ServerScript 
end)

Server Script:

local RE = game:GetService('ReplicatedStorage'):WaitForChild('RemoteEvent')

RE.OnServerEvent:Connect(function() -- with this line, you receive the signal
	-- Do stuff, show GUI etc 
end)

For the local script, your basically activating the code and server script is actually doing it. Read the Remote Events for more information, RemoteEvents can also send variables, but that is for other stuff. Anyway, I hope this helped you in some sort of way. If so please Upvote and accept answer

-- Your orange, BlackOrange3343 PS: Good luck on your game

2 comments

0

ty for your time but i know how to script with fe the problem i had is because a player used r6 character and i made this only r15 compatible and forgot to morph it in settings

0

Alright good to know

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