Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is my script that worked perfectly fine yesterday having issues today?

I might be wrong but I do remember ROBLOX Studio having an update yesterday. I made this script which was working perfectly fine then out of nowhere today comes up and it's just completely broken. If anyone knows what changed in the update or why it broke my script then I would appreciate it very much.

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character

local function CAdded()
    print(Player.Name.. " Connected")
    print(Player.Name.. "'s Character Connected")
    if Character:WaitForChild("Daku") ~= nil then
        local Moveset = Player.PlayerGui.ScreenGui.DakuM
        Moveset.Visible = true
    end
end

Player.CharacterAdded:Connect(CAdded)

4 comments

0

I'm not sure if this will help, but try doing

local Character = Player.Character or Player.CharacterAdded:Wait()

0

Can't you technically use the character parameter passed by CharacterAdded?

0

Yeah that's true I'm going to try to change it up a bit.

0

Nothing worked. I'm just going to do some more research on the changes ROBLOX added.

1 answer

Uh not sure this will fix your problem, but I noticed you used

 if Character:WaitForChild("Daku") ~= nil then

when it should be

 if Character:FindFirstChild("Daku") ~= nil then

because WaitForChild() just waits for the child and doesn't stop waiting until the child is found, therefore never producing nil, while FindFirstChild() searches to see if the child is there and if it's not, it becomes nil.

This discussion is preserved as it was. New answers, comments, and votes are closed.