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

How can i set a bool value with script?[Closed]

Hello, i looked in many places but could not find something that worked for me. I have a script in starterplayerscripts and i have a bool value inside the script and its named "Value" and i cant set it it wont work when test it, why?

script.Parent.Parent.Chatted:Connect(function(msg)
	if msg == "KAMEHAMEHA" then
	if can == true then
		can = false
		script.Value.Value = true
--[=[This Content was deleted as this big script can be copied without a trace of the person since they can easily also take out my name in the script]=]
can = true
end
end
end)

This might be incorrect syntax but the real thing works. exept for the value, its not setting value to true. please help <:)

3 comments

0

do i need quotes?no wait , thats for string values...

0

what does "can" refer to?

0

a variable, so this pauses when i want, it can be anything really, it sets anything, and its true at beginning, if true it works, and sets to false so the script cant function AGAIN while it already is.

2 answers

Alright, so I looked at this script, and after testing it, it works perfectly fine as it is, i used the line

local can = true

to check this.

(My Version, essentially the same thing)

local can = true
local player = script.Parent.Parent

player.Chatted:Connect(function(msg)
	if msg == "KAMEHAMEHA" then
		if can == true then
			can = false
			script.Value.Value = true
			-- Content Removed
			can = true
		end
	end
end)

The problem I'm guessing is that you are using a Server Script In the StarterPlayerScripts, where only Local Scripts can be run. I'm not sure how this may/may not mess up your other functions, but doing this will fix the section provided.

If you don't want this function to occur again though, I'm not sure why you'd set "can" back to true.

1 comment

0

what are you TALKING ABOUT!!!??!?!?? That part works! the can thing works, i cant do it while its already doing its thing! the value thing doesnt work whatever im just gonna close this

Closed, not really because i cant but i Am just gonna abandon this question since i don't need it anymore

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