Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I code player specific scripts?

Asked by 6 years ago

For E.G

If i want bloom to be active for only a player when he walks over a specific area. What terms do I use that only THAT SPECIFIC player that has WALKED at that area will see the bloom effect and the script shouldn't make the bloom active for everyone.

0
use a local script and part touched? DanielDeJong3 158 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

The best and quickest solution for this is to use FilteringEnabled and part hitboxes.

When a hitbox is touched, the server sends an event to the client that it then receives and creates a local bloom effect that will only be visible on the client.

Here's an example of a Server Script in a hitbox part that'll send the event to the client:

local Hitbox = script.Parent

Hitbox.Touched:connect(function(Object))
if Object.ClassName == "Part" then
if Object.Parent:FindFirstChild("Humanoid") then
local Player = game.Players:GetPlayerFromCharacter(Object.Parent)
Player.SomeEventsFolder.ActivateBloom:FireClient(Player)
end
end
end)

(Haven't tested)

Then you'll just set everything up, make a folder in StarterPlayerScripts with the event and a local script that will listen to the event and make a bloom effect when needed, also don't forget to edit the script above if you're using it, the remote firing line includes randomly picked directories.

0
Can you please guide me through AlexStorms 21 — 6y
Ad

Answer this question