local chest = game.Workspace:WaitForChild("Chest")
local chestHealth = chest:WaitForChild("Health")
local tweenService = game:GetService("TweenService")
game.ReplicatedStorage.EggHatchingRemotes.ChestEvent.OnServerEvent:Connect(function(plr)
chest.Health.Value -= plr.Values.Multiplier1.Value
chest.SurfaceGui.Frame.TextLabel.Text = chestHealth.Value.." / 1000"
if chestHealth.Value <= 0 then
tweenService:Create(chest, TweenInfo.new(0.1), {Size = Vector3.new(0,0,0)}):Play()
wait(1)
chest:Destroy()
end
end)
#Part is not getting tweened instead the Gui is
1 messages · Page 1 of 1 (latest)
the chest is a part
pls anyone help
im stuck at this issue which should be easy
how tho
@solar grotto
i dont think i am where am i doing tha
t
ok the problem was the mesh thanks a lot
do u know how how to make the boss chest respawn?
local chest = game.ServerStorage:WaitForChild("Chest")
local chestHealth = chest:WaitForChild("Health")
local tweenService = game:GetService("TweenService")
local chestHealthMax = 1000
local clonedChest = chest:Clone()
local mesh = chest:WaitForChild("Mesh")
game.ReplicatedStorage.EggHatchingRemotes.ChestEvent.OnServerEvent:Connect(function(plr)
chest.Health.Value -= plr.Values.Multiplier1.Value
chest.SurfaceGui.Frame.TextLabel.Text = chestHealth.Value.." / 1000"
chest.SurfaceGui.Frame.TextLabel.Size = UDim2.new(chestHealth.Value / chestHealthMax, 0,1,0)
if chestHealth.Value <= 0 then
chest.SurfaceGui.Enabled = false
tweenService:Create(mesh, TweenInfo.new(0.2), {Scale = Vector3.new(0,0,0)}):Play()
wait(1)
chest:Destroy()
wait(5)
clonedChest.Parent = game.Workspace
end
end)
cuz when im doing this
the Cloned chest doesnt work
cuz it looks for the click detector of the original one'
this is the client side ```lua
local chest = game.ServerStorage:WaitForChild("Chest")
local player = game.Players.LocalPlayer
local chestHealth = chest:WaitForChild("Health")
local mouse = player:GetMouse()
local chestClickDetector = chest.ClickDetector
chestClickDetector.MouseClick:Connect(function()
game.ReplicatedStorage.EggHatchingRemotes.ChestEvent:FireServer()
end)
local chest = game.ServerStorage:WaitForChild("Chest")
local chestHealth = chest:WaitForChild("Health")
local tweenService = game:GetService("TweenService")
local chestHealthMax = 1000
local mesh = chest:WaitForChild("Mesh")
game.ReplicatedStorage.EggHatchingRemotes.ChestEvent.OnServerEvent:Connect(function(plr)
chest.Health.Value -= plr.Values.Multiplier1.Value
chest.SurfaceGui.Frame.TextLabel.Text = chestHealth.Value.." / 1000"
chest.SurfaceGui.Frame.TextLabel.Size = UDim2.new(chestHealth.Value / chestHealthMax, 0,1,0)
if chestHealth.Value <= 0 then
chest.SurfaceGui.Enabled = false
tweenService:Create(mesh, TweenInfo.new(0.2), {Scale = Vector3.new(0,0,0)}):Play()
wait(1)
chest:Destroy()
wait(5)
local clonedChest = chest:Clone()
clonedChest.Parent = game.Workspace
end
end)```
try that
i managed to fix it thanks so much I dont think i did it good bc i made a loop on the client side that checks the variables non stop
bc the chest when destroyed a new one comes
and the variables should tkae up the new chests