Yes, and it STILL doesn’t work. I seriously don’t understand what’s wrong with this. I shouldn’t even need to make this Variable Update script thingy! It’s just the scripts that dissapear once the player dies which isn’t supposed to happen at all!
Yeah all scripts related to players humanoid should be inside the StarterCharacterScripts folder because those scripts are always active once the player spawns.
Doesn’t seem to be the case for me! Doesn’t matter if they are 3 separate scripts or 1 full script, it just always disappears from the player’s character once he respawns, even if it’s in StarterCharacterScripts!
So that means your error happens because the script can’t find the player once they die (Roblox deletes the player’s character and replaces it once they die)
Have you tried putting those individual scripts in a brand new empty game file? It could help you find your problem.
Just tried that, even in a brand new game file it still doesn’t work. I forgot to mention there’s this script located in ServerScriptService that adds sound effects to the Character and also adds Leaderstats, tho i’m not sure how it would cause this problem.
--//Variables//--
local Players = game:GetService("Players")
--------------------------------------------
local CoinsFolder = workspace.Coins
local CoinTable = CoinsFolder:GetChildren()
local IBFolder = workspace.ItemBlocks
local IBTable = IBFolder:GetChildren()
--//Function//--
local function onPlayerAdded(Player)
--_Leaderstats_------------------------------------
local LeaderStats = Instance.new("Folder")
LeaderStats.Name = "leaderstats"
--------------------------------------
local Coins = Instance.new("IntValue")
Coins.Name = "Coins"
Coins.Value = 0
Coins.Parent = LeaderStats
---------------------------
LeaderStats.Parent = Player
--_SoundEffects_-----------------------------------------
local Character = Player.Character or Player.CharacterAdded:Wait()
local Root = Character:WaitForChild("HumanoidRootPart")
--------------------------------
local Footstep = Instance.new("Sound", Root)
Footstep.Name = "SteppingSound"
Footstep.SoundId = "rbxassetid://13301979983"
Footstep.Looped = true
Footstep.PlaybackSpeed = .9
Footstep.Volume = .25
Footstep.RollOffMode = Enum.RollOffMode.Linear
Footstep.RollOffMinDistance = 5
Footstep.RollOffMaxDistance = 75
--------------------------------
local LandingSound = Instance.new("Sound", Root)
LandingSound.Name = "LandingSound"
LandingSound.SoundId = "rbxassetid://6877211005"
LandingSound.PlaybackSpeed = 1.25
LandingSound.Volume = .65
LandingSound.RollOffMode = Enum.RollOffMode.Linear
LandingSound.RollOffMinDistance = 5
LandingSound.RollOffMaxDistance = 75
--------------------------------
local Step = Instance.new("Sound", Root)
Step.Name = "StepTJ"
Step.SoundId = "rbxassetid://13301979983"
Step.PlaybackSpeed = 0.9
Step.Volume = .25
Step.RollOffMode = Enum.RollOffMode.LinearSquare
Step.RollOffMinDistance = 5
Step.RollOffMaxDistance = 75
----------------------------------------------------
local Whoosh = Instance.new("Sound", Root)
Whoosh.Name = "WhooshTJ"
Whoosh.SoundId = "rbxassetid://13302738007"
Whoosh.PlaybackSpeed = .9
Whoosh.Volume = .35
Whoosh.RollOffMode = Enum.RollOffMode.LinearSquare
Whoosh.RollOffMinDistance = 5
Whoosh.RollOffMaxDistance = 75
end
--------------------------------------------
for _, Coin in pairs(CoinTable) do
local function onCoinTouched(Hit)
---------------------------------------------------------
local Player = Players:GetPlayerFromCharacter(Hit.Parent)
---------------------------------------------------------
if Player == nil then
return
end
--------------------------------------------------------------------------------
local LeaderStats = Player:WaitForChild("leaderstats")
local CoinVal = LeaderStats:WaitForChild("Coins")
CoinVal.Value = CoinVal.Value + 1
task.wait(0.5)
Coin:Destroy()
end
Coin.Touched:Once(onCoinTouched)
end
--------------------------------------------
for _, Block in pairs(IBTable) do
if Block:IsA("Model") and Block.Name == "ItemBlock" then
local Hitbox = Block.Hitbox
local HitS = Hitbox.HitS
local function onTouched(Hit)
if Hit and Hit.Parent:FindFirstChild("Humanoid") then
---------------------------------------------------------
local Player = Players:GetPlayerFromCharacter(Hit.Parent)
---------------------------------------------------------
if Player == nil then
return
end
--------------------------------------------------------------------------------
local LeaderStats = Player:WaitForChild("leaderstats")
local CoinVal = LeaderStats:WaitForChild("Coins")
CoinVal.Value = CoinVal.Value + 5
end
end
Hitbox.Touched:Once(onTouched)
end
end
--------------------------------------------
Players.PlayerAdded:Connect(onPlayerAdded)
Do you have a screenshot of the error message by chance?
There’s no errors at all in the output. Also the scripts do appear in the Character even after death, both in the normal game and the new empty game, but they don’t work?
This is a very strange problem that I’ve never really experienced before. Have you tried putting it into the StarterGUI?
Even putting it in StarterGui changes nothing! What the actual hell???
Do you have any free models in your game?
Nope, every model and script is made by me, except the Pine Trees models, but they are marked as a high quality item and they are safe to use as far as i know.
You could try making a new script that prints something once the player spawns and then prints something once they die.
Or you could make a script that essentially does what roblox does and just clones the scripts into the player once they spawn
That’s the thing. The character still has the scripts even after respawning, it’s just they REFUSE to work.
any infinite yield in the output
Ok so try debugging the scripts if you haven’t already (which I bet you have) by putting print("Whatever player is doing currently")
just to see if the scripts are even getting past a point
This normally either lags out or will give you an output. But it could be the cause
Nope, literally nothing in the output.
After the player respawns, it prints the first print statement at the very beginning of the script, but then it doesn’t print the other ones at all.