You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want to make people dissapear/appear on function call for the client
-
What is the issue? Include screenshots / videos if possible!
The person dissapears, then when he appears he looks like this. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Nothing really, just can’t find the issue.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Does anyone see the problem? Also im posting the full script and mabye you can tell me what can I improve?
local tweenService = game:GetService("TweenService")
local promptService = game:GetService("TweenService")
local plrService = game:GetService("Players")
local player = game.Players.LocalPlayer
local controls = require(player.PlayerScripts.PlayerModule):GetControls()
-- Objects
local plrCamera = workspace.Camera
local prompt = game.Workspace.spawnhouse.counter.man.Head.prompt.ProximityPrompt
--Hide players
local hiddenParts = {}
function hidePlayers()
for i, plr in pairs(plrService:GetChildren()) do
local plrChar = plr.Character
for i, part in pairs(plrChar:GetChildren()) do
if part:IsA("Part") or part:IsA("MeshPart") then
part.Transparency = 1
table.insert(hiddenParts,part)
elseif part:IsA("Accessory") then
part:FindFirstChild("Handle").Transparency = 1
table.insert(hiddenParts,part)
end
end
end
end
-- Show players
function showPlayers()
for i, part in pairs(hiddenParts) do
local index = table.find(hiddenParts,part)
if part:IsA("Accessory") then
part:FindFirstChild("Handle").Transparency = 0
else
part.Transparency = 0
end
table.remove(hiddenParts,index)
end
end
--Cutscene style
local duration = 3
local tweenInfo = TweenInfo.new(
duration,
Enum.EasingStyle.Sine,
Enum.EasingDirection.InOut,
0,
false,
0
)
-- Cutscene zooms on NPC
local cutScenePart = script.Parent.cutSceneParts.cam1.CFrame
local function tween (loc1, loc2)
plrCamera.CameraType = Enum.CameraType.Scriptable
local tween = tweenService:Create(plrCamera, tweenInfo, {CFrame = loc2})
controls:Disable()
prompt.Enabled = false
tween:Play()
hidePlayers()
wait(duration)
end
-- Event listeners
prompt.Triggered:Connect(function()
tween(plrCamera.CFrame,cutScenePart)
end)
wait(5)
hidePlayers()
wait(5)
showPlayers()