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

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

Asked by 5 years ago
Edited 5 years ago

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 <:)

0
do i need quotes?no wait , thats for string values... CommanderCaubunsia 126 — 5y
0
what does "can" refer to? SerpentineKing 3885 — 5y
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. CommanderCaubunsia 126 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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.

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 CommanderCaubunsia 126 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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

Answer this question