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’m making an efficient Status Effect system for my roblox horror game. -
What is the issue? Include screenshots / videos if possible!
Only for the speed effect, I’m getting this error:
10:54:38.265 WalkSpeed is not a valid member of Player "Players.superman978705" - Server - EffectHandler:32
- What solutions have you tried so far? Did you look for solutions on the Creator Hub?
ChatGpt, dev forum, everything lol
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!
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local StatusAdd = ReplicatedStorage.Remotes:FindFirstChild("StatusEffect")
local NauseaEvent = ReplicatedStorage.Remotes:FindFirstChild("NauseaEvent")
-- Function to convert numbers to Roman numerals
local function toRoman(num)
local numerals = {
{1000, "M"}, {900, "CM"}, {500, "D"}, {400, "CD"},
{100, "C"}, {90, "XC"}, {50, "L"}, {40, "XL"},
{10, "X"}, {9, "IX"}, {5, "V"}, {4, "IV"}, {1, "I"}
}
local result = ""
for _, pair in ipairs(numerals) do
while num >= pair[1] do
result = result .. pair[2]
num = num - pair[1]
end
end
return result
end
-- Table of effects and their impact
local Effects = {
["Slowness"] = function(humanoid, level)
if humanoid and typeof(humanoid.WalkSpeed) == "number" then
humanoid.WalkSpeed = math.max(0, (tonumber(humanoid.WalkSpeed) or 16) - (level * 2)) -- Reduce speed
end
end,
["Speed"] = function(humanoid, level)
if humanoid and typeof(humanoid.WalkSpeed) == "number" then
humanoid.WalkSpeed = (tonumber(humanoid.WalkSpeed) or 16) + (level * 2) -- Increase speed
end
end,
["Poison"] = function(player, level)
local character = player.Character
local humanoid = character and character:FindFirstChild("Humanoid")
if humanoid then
local healthReduction = level * 2
local duration, tickRate = 10, 1
task.spawn(function()
for i = 1, duration do
if humanoid and humanoid.Health > 0 then
humanoid.Health = math.max(0, humanoid.Health - healthReduction)
end
task.wait(tickRate)
end
end)
end
end,
["Regeneration"] = function(player, level)
local character = player.Character
local humanoid = character and character:FindFirstChild("Humanoid")
if humanoid then
local healthAddition = level * 2
local duration, tickRate = 10, 1
task.spawn(function()
for i = 1, duration do
if humanoid then
humanoid.Health = math.min(humanoid.MaxHealth, humanoid.Health + healthAddition)
end
task.wait(tickRate)
end
end)
end
end,
["Nausea"] = function(player, level)
local duration = 10
local intensity = level * 0.5
-- Apply Blur Effect
local blur = Instance.new("BlurEffect")
blur.Size = intensity * 10
blur.Parent = game.Lighting
-- Apply Green Tint
local colorCorrection = Instance.new("ColorCorrectionEffect")
colorCorrection.TintColor = Color3.fromRGB(150, 255, 150)
colorCorrection.Parent = game.Lighting
-- Random Stumbling Effect
local character = player.Character
local humanoid = character and character:FindFirstChild("Humanoid")
if humanoid then
task.spawn(function()
for i = 1, duration do
humanoid.WalkSpeed = math.random(8, 16)
task.wait(1)
end
humanoid.WalkSpeed = 16
end)
end
-- Remove effects after duration
task.delay(duration, function()
blur:Destroy()
colorCorrection:Destroy()
end)
end,
}
-- Function to apply status effect and update UI
local function applyEffect(plr, effectName, level, duration)
local character = plr.Character
local humanoid = character and character:FindFirstChild("Humanoid")
if humanoid and Effects[effectName] then
Effects[effectName](plr, level)
-- Find player's UI
local playerGui = plr:FindFirstChild("PlayerGui")
if not playerGui then warn("PlayerGui missing for:", plr.Name) return end
local list = playerGui:FindFirstChild("StatusEffectList")
if not list then warn("StatusEffectList missing for:", plr.Name) return end
local template = list:FindFirstChild("Template")
if not template then warn("Template missing for:", plr.Name) return end
-- Clone and update UI
local effectUI = template:Clone()
effectUI.Parent = list
effectUI.StatName.Text = effectName .. " " .. toRoman(level)
effectUI.Visible = true
-- Timer countdown
task.spawn(function()
local remaining = duration
while remaining > 0 do
effectUI.Timer.Text = string.format("%02d:%02d", math.floor(remaining / 60), remaining % 60)
task.wait(1)
remaining -= 1
end
effectUI:Destroy()
end)
-- Restore effect after duration
task.delay(duration, function()
if humanoid and (effectName == "Slowness" or effectName == "Speed") then
humanoid.WalkSpeed = 16
end
end)
end
end
-- Listen for effect requests from the client
if StatusAdd then
StatusAdd.OnServerEvent:Connect(function(plr, effectName, level, duration)
applyEffect(plr, effectName, level, duration)
end)
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.