hello developers of roblox
You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
-The code shown below is placed inside a module script, the module script functions as an ending script, when a player does something to trigger the ending, for this instance, eating a forbidden chip. -
What is the issue?
- in the module script you can see in the line that contains a print(“Test test”), it’s to test whether the script is running as it should. But it doesn’t appear in the output. No errors were shown in the output, but the script refuses to work. Everything else above that line works, the gui, the sound, everything works, even the lines of code that comes after a task.wait(). Weirdly enough, if i happen to remove the task.wait(3) that comes before the print(“test test”), the text appears in the output.
- What solutions have you tried so far?
- I searched everywhere, finding flaws in the script that could’ve been potentially causing this error. But i’ve yet to find anything that has helped me
-- Variables --
local SScript = game:GetService("ServerScriptService")
local RStorage = game:GetService("ReplicatedStorage")
local EndingsManager = require(SScript.Ending.EndingSettings)
local TweenService = game:GetService("TweenService")
local Audio = require(SScript.ModuleCode.SoundModule)
local AudioData = require(RStorage.ClientModules.GameData)
local Module = {}
-- Event functions for each ending
local events = {
Pandemic = function(player)
end,
UnsuccessfulEvasion = function(player)
end,
ForbiddenSnack = function(player)
local frame = player.PlayerGui.UI.EndingUI.MainFrame
-- Event logic for the ForbiddenSnack ending
-- Obtain necessary information from the EndingsManager
local endingData = EndingsManager.endings.ForbiddenSnack
local badgeId = endingData.badgeId
local kickMessage = endingData.kickMessage
local endingName = endingData.endingName
-- Perform actions specific to the ForbiddenSnack ending
-- Cutscene
local character = player.Character
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
local humanoidRootPart = character and character:FindFirstChild("HumanoidRootPart")
if not humanoid or not humanoidRootPart then
warn("Character or HumanoidRootPart not found for player: " .. player.Name)
return
end
-- Additional Functionalities
workspace.GameContainer.Audio.StomachGrowl:Play()
task.wait(3)
Audio.PlaySound(AudioData.SkibiBomb, 1, character.Torso, false)
workspace.GameContainer.Audio.StomachGrowl:Stop()
task.wait(1.1)
local explosion = Instance.new("Explosion")
explosion.Parent = workspace.TemporaryFX
explosion.Position = humanoidRootPart.Position
game.Debris:AddItem(explosion, 3)
task.wait(2)
workspace.GameContainer.Audio.Announcer_Defeat:Play()
frame.Visible = true
-- Initial position
local startPos = UDim2.new(0.5, 0, -0.9, 0)
-- Final position after bounce
local endPos = UDim2.new(0.5, 0, 0.5, 0)
-- Create the tween info for the bounce
local bounceInfo = TweenInfo.new(
2, -- Duration of the tween (5 seconds)
Enum.EasingStyle.Bounce, -- Bouncing easing style
Enum.EasingDirection.Out, -- Outward direction
0, -- Number of times to repeat (0 means no repeat)
false, -- Reverses the tween when repeating
0 -- Delay before starting the tween (in seconds)
)
-- Create the tween
local bounceTween = TweenService:Create(frame, bounceInfo, {Position = endPos})
bounceTween:Play()
task.wait(3)
print("test test")
end,
-- Add more events for different endings here...
}
-- Function to trigger an ending event
function Module.TriggerEnding(player, endingName)
local event = events[endingName]
if event then
event(player)
else
warn("No event found for the ending: " .. endingName)
end
end
return Module
Help would be appreciated