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

Using a LocalScript to create and place a message into workspace, but still Local?

I have a LocalScript in each players gui that would kick them for having forcefield. The only problem i am having is when it creates a hint,

player = game.Players.LocalPlayer

Instance.new("Hint", game.Workspace)
Hint.Text = (player.Name .. " is using ForceField!")
player:Kick("Kicked for using FF")

--This is just a sample, not the full script.

the message goes local to the player instead of showing to everyone in the workspace. The message is supposed to say that the player is using forcefield. Why is that?

1 comment

0

Use a remote event to signal the server and make a hint. If you're using FilteringEnabled it's because things made on the client, aka the player's computer, don't replicate to the server, aka Roblox; however, if you were to have the server make the instance, it would go to all the clients.

1 answer

✓ Accepted answer

It only shows for the player, meaning that you're using Filtering Enabled. There are many great videos and tutorials you can find, even a blog on here, so I think it would be a waste of time for me to go over it. But in short, if something was to happen on a client, it will not effect the server. However, you can use remote events and functions to signal changes. So for example:

local remote = game.ReplicatedStorage.HINTS -- this is referring to a remote event inside of replicatedstorage, named HINTS

remote:FireServer() -- This signals the event, with the player being the only parameter (although not mentioned)
--this is a normal script inside of server script storage
local remote = game.ReplicatedStorage.HINTS

remote.OnServerEvent:Connect(function(Player)
	Hint = Instance.new("Hint", workspace) -- Make it a variable, and use workspace instead of game.Workspace
	
	Hint.Text = (player.Name .. " is using ForceField!") --now adjust that variable
	player:Kick("Kicked for using FF") -- kick them out frm the server sided script
	game.Debris:AddItem(Hint,5) -- Simply to get rid of the hint after 5 seconds
end)

There are probably typos and errors in my code, I just made this here in a few minutes. Anyways, I hope this example helped you understand a little about remote events, and should work!

2 comments

0

I'm not using FilteringEnabled but this works, thanks!

0

No problem

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