This is probably easy to do but I ain’t good at scripting this is a jump scare block and when u touch it it activates a jump scare how can I make it where u can only see it once for that one player so destroy after touch but only for the person who touches it
LocalScripts
are pretty much your key friend here, as they’re capable of handling everything for the client to see only
Since it’s being done for every individual client, you could just reference that script as a LocalScript
instead, reference it inside StarterPlayerScripts
, & re-define the Part
Upon touching it, it would only be triggered by 1 player to see for so that you can jumpscare that specific player
Was that the bite of 87’?
How do I make it where u can’t touch it again tho cuz u can keep spamming it
Just simply add a debounce like you put inside your script
local Player = game.Players.LocalPlayer
local jumpscareModule = require(game.ReplicatedStorage:WaitForChild("Modules"):WaitForChild("Jumpscare Manager")
local DB = false
local Players = game:GetService("Players")
local Part = --Define part here
Part.Touched:Connect(function(Hit)
local HitPlayer = game.Players:GetPlayerFromCharacter(Hit.Parent)
if HitPlayer and HitPlayer == Player and not DB then
DB = true
jumpscareModule.Jumpscare(Player)
wait(1)
DB = false
end
end)
If it’s a server script can the whole lobby see it?
Things executed from server scripts can be seen by everyone in the server so yes.
although there are some exceptions
Pretty much
Differences:
-
Server Scripts are handled globally/server side, so everyone would be able to see it
-
Local Scripts are handled your/client side, so only you would see it