Hey there!
(I’m assuming this goes in scripting support)
How would I go about making a pair of glasses that, when worn, the player who is wearing them sees creatures, and when they touch those creatures, it kills them? The hard parts are that everything bout it has to be local. The monsters can’t be touched or kill or make noises when the player is not wearing them, or to anyone else. For a better understanding of what I’m trying to recreate, read this: SCP-178 - SCP Foundation
I appreciate any and all help. I do know that this will take several local scripts, to say the least.
2 Likes
Viewport frames are what I’d use, or just parent in monsters when they are worn.
1 Like
What I would do is have the monsters spawn on the server but they cannot interact/collide with normal players who have not worn the glasses. When someone wears the glasses their client can set the LocalTransparencyModifier
of the bodyparts of the monsters to -1 so that they are visible and the server can enable a boolean in a table or other datatype that is linked to the player, like below:
-- Server script
local Player = game:GetService('Players')
local GlassesWornTable = {}
local Monsters = {} -- A table of your monsters
local function PlayerAdded(player: Player)
GlassesWornTable[player.UserId] = false
end
local function PlayerRemoving(player: Player)
GlassesWornTable[player.UserId] = nil
end
for _, player in ipairs(Players:GetPlayers()) do
PlayerAdded(player)
end
Players.PlayerAdded:Connect(PlayerAdded)
-- Idk how your glasses work but I would connect these to a `ChildAdded` event
-- that checks if the added item is an accessory and is scp 178 and then triggers
-- the function
local function PlayerWorn178(player: Player)
GlassesWornTable[player.UserId] = true
for _, monster in ipairs(monster) do
-- This is what I would do, if you have different monsters than you need
-- to have something different
monster:SetAttackable(player, true)
end
end
-- Local script
local Monsters = {} -- A reference to the monsters
local function LocalPlayerWorn178(player: Player)
for _, monster in ipairs(monster) do
for _, bodyPart in ipairs(monster:GetChildren()) do
if not bodyPart:IsA('BasePart') then
continue
end
bodyPart.LocalTransparencyModifier = -1
bodyPart.CanCollide = true
end
end
end