#Fuse Box X Lamps
1 messages · Page 1 of 1 (latest)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local FuseTracker = require(ReplicatedStorage:WaitForChild("FuseTracker"))
local errorEvent = ReplicatedStorage:WaitForChild("FuseBoxErrorEvent")
local successEvent = ReplicatedStorage:WaitForChild("FuseBoxSuccessEvent")
local fuseBox = script.Parent
local prompt = fuseBox:WaitForChild("ProximityPrompt")
-- Find the door to open (will search for a Model or Part named "Door" in workspace)
local door = workspace:FindFirstChild("Door", true)
print("[FuseBoxInteraction] FuseBox interaction system ready")
if door then
print("[FuseBoxInteraction] Found door to open:", door:GetFullName())
else
warn("[FuseBoxInteraction] No door found in workspace! Create a Model or Part named 'Door' to enable door opening.")
end
prompt.Triggered:Connect(function(player)
print("[FuseBoxInteraction]", player.Name, "interacted with FuseBox")
if FuseTracker.HasAllFuses(player) then
print("[FuseBoxInteraction]", player.Name, "has all 4 fuses! Opening door...")
-- Disable the prompt so it can't be triggered again
prompt.Enabled = false
-- Open the door
if door then
if door:IsA("Model") then
-- If door is a Model, move it
** You are now Level 2! **
upward or to the side
local primaryPart = door.PrimaryPart or door:FindFirstChildWhichIsA("BasePart")
if primaryPart then
local targetCFrame = primaryPart.CFrame * CFrame.new(0, 10, 0) -- Move 10 studs up
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local tween = TweenService:Create(primaryPart, tweenInfo, {CFrame = targetCFrame})
tween:Play()
print("[FuseBoxInteraction] Door Model opening animation started")
end
elseif door:IsA("BasePart") then
-- If door is a Part, move it or make it transparent
local targetCFrame = door.CFrame * CFrame.new(0, 10, 0)
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local tween = TweenService:Create(door, tweenInfo, {CFrame = targetCFrame, Transparency = 1})
tween:Play()
-- Disable collision after animation
task.delay(2, function()
door.CanCollide = false
end)
print("[FuseBoxInteraction] Door Part opening animation started")
end
end
-- Fire success message to client
successEvent:FireClient(player)
else
local collectedCount = FuseTracker.GetCollectedCount(player)
print("[FuseBoxInteraction]", player.Name, "only has", collectedCount, "fuses. Need all 4!")
errorEvent:FireClient(player)
end
end)
Can you show me what's written in the FuseTracker?
local FuseTracker = {}
local playerFuses = {}
function FuseTracker.InitializePlayer(player)
if not playerFuses[player.UserId] then
playerFuses[player.UserId] = {
["Fuse 1"] = false,
["Fuse 2"] = false,
["Fuse 3"] = false,
["Fuse 4"] = false
}
print("[FuseTracker] Initialized fuses for player:", player.Name)
end
end
function FuseTracker.CollectFuse(player, fuseName)
FuseTracker.InitializePlayer(player)
if playerFuses[player.UserId][fuseName] ~= nil then
playerFuses[player.UserId][fuseName] = true
print("[FuseTracker] Player", player.Name, "collected", fuseName)
return true
else
warn("[FuseTracker] Invalid fuse name:", fuseName)
return false
end
end
function FuseTracker.HasAllFuses(player)
FuseTracker.InitializePlayer(player)
local fuses = playerFuses[player.UserId]
return fuses["Fuse 1"] and fuses["Fuse 2"] and fuses["Fuse 3"] and fuses["Fuse 4"]
end
function FuseTracker.GetCollectedCount(player)
FuseTracker.InitializePlayer(player)
local count = 0
for fuseName, collected in pairs(playerFuses[player.UserId]) do
if collected then
count = count + 1
end
end
return count
end
function FuseTracker.ClearPlayerFuses(player)
playerFuses[player.UserId] = nil
print("[FuseTracker] Cleared fuses for player:", player.Name)
end
return FuseTracker
does something show up on the output?
when i try inputing the fuses?
yea
this is what shows up when starting the game
nothing changes when trying to input the fuses
the plugin should have nothing to do with it right?
yea
maybe u gotta add prints to debug it
can you send all the code in one message?
you can do that
like this?
😭
nononono
remove the print
i will try to fix the code for you rq
I have no idea what im doing 🥲
no because i have a part named Door
should i try and remove it?
tried removing it nothing changed
that is rlly strange
where is your script at?
on the explorer
i tried doing the exact same things as yours and it could print
the fuse tracker or the main script?
and when you try to active the proximity prompt it were supposed to also send a message to the output
both
wait no
only the main script
i know your fuse tracker is at replicated storage
main script is located in the fusebox model
try dragging it to serverscriptservice
i frogot i also have a script called FuseCollectionHandler in serverscript service
ill send it here
send it
i cant send it??
what happens
Clyde says that i dont share a server with the recipent