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

Is my script causing prevent me to test out my games in studio?

Every time I wanted to test out my game it simply just stops at 33%, i'm not sure if its my scripts causing the studio to bugging out.

#Script1_BanService


--start of script

local sservice = game.ServerScriptService

if script.Parent ~= sservice then 
	script.Parent = game.ServerScriptService
end

--wait() can screw banservice check

local Bstat = game:GetService("DataStoreService"):GetDataStore("BanService_1")
local Wstat = game:GetService("DataStoreService"):GetDataStore("BanService_1")
local Rstat = game:GetService("DataStoreService"):GetDataStore("BanService_1")

--create ui message when ban/warning is  true

--[[
local ReasonMessageValue = Instance.new("StringValue")--finish this man
local storedDatas = Instance.new("Folder")
storedDatas.Parent = game.ServerScriptService
ReasonMessageValue.Parent = storedDatas
ReasonMessageValue.Value = "nil"
ReasonMessageValue.Name = "Value"
]]-- Waste of time, idea discarded

--function sendval()
--end


--function sendtoui()
--end

game.Players.PlayerAdded:connect(function(player)
	local Banned = "user_" ..player.userId
	local Warning,Reason = "user_" ..player.userId
	if Bstat:GetAsync(Banned) == 1 then
		ReasonMessageValue.Text = ReasonMessageValue
		kick()
	end
end)

2 comments

0

What do you mean by, "It stops at 33%"? Nothing here seems like it would cause issues with your game itself or conflict with it in any way - and even if it did you could just pcall it.

0

You will get an error: 'ReasonMessageValue a nil value' because you commented the variable that defines it. You will also get a error for kick() because there are no functions named 'kick'. You can kick a player like this: player:Kick("reason in string"). Make sure you have autosave enabled so when it freezes you can restart studio and open the auto saved file.

3 answers

I had something similar happen to me. My problem was that i didn't have wait() in the script, and this apparently made the studio freeze when i tried to test.

while true do
	--wait() was missing
	--some other codes
end

Maby try this:

if script.Parent ~= sservice then 
	wait() --try to add this and see if that helps
	script.Parent = game.ServerScriptService
end

3 comments

0

Where do you see a while true do loop in his script, Please?

0

@Asworme, there is no call for this level of toxicity - he is clearly trying to help, so treat him with civility.

0

It's fine. I don't tend to take things to heavily. I just suggested the use of wait() because i got a similar problem with testing a while ago because of the absence of wait() in one of my scripts.

Alright, first of all, userId is deprecated, use UserId instead, also you should be using Connect instead of connect.

--start of script

local sservice = game.ServerScriptService

if script.Parent ~= sservice then 
    script.Parent = game.ServerScriptService
end

--wait() can screw banservice check

local Bstat = game:GetService("DataStoreService"):GetDataStore("BanService_1")
local Wstat = game:GetService("DataStoreService"):GetDataStore("BanService_1")
local Rstat = game:GetService("DataStoreService"):GetDataStore("BanService_1")

--create ui message when ban/warning is  true

--[[
local ReasonMessageValue = Instance.new("StringValue")--finish this man
local storedDatas = Instance.new("Folder")
storedDatas.Parent = game.ServerScriptService
ReasonMessageValue.Parent = storedDatas
ReasonMessageValue.Value = "nil"
ReasonMessageValue.Name = "Value"
]]-- Waste of time, idea discarded

--function sendval()
--end


--function sendtoui()
--end

game.Players.PlayerAdded:Connect(function(player)
    local Banned = "user_" ..player.UserId
    local Warning,Reason = "user_" ..player.UserId
pcall(function()
    if Bstat:GetAsync(Banned) == 1 then
        ReasonMessageValue.Text = ReasonMessageValue
        kick()
end)
    end
end)
~~~~~~~~~~~~~~~~

2 comments

0

Retarded lua block wont show up the script...

0

DEPRECATION ~= BUG 95% of the time. The fact that these calls are deprecated is not the issue with his script.

Still stuck at 33%. I've rewritten the script with no errors and bugs and my studio stops at 33% when testing

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