Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 5 years ago

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)
0
I'm not sure if this will help, but try doing local Character = Player.Character or Player.CharacterAdded:Wait() vissequ 105 — 5y
0
Can't you technically use the character parameter passed by CharacterAdded? DeceptiveCaster 3761 — 5y
0
Yeah that's true I'm going to try to change it up a bit. songboy50 77 — 5y
0
Nothing worked. I'm just going to do some more research on the changes ROBLOX added. songboy50 77 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

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.

Ad

Answer this question