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

Help with fixing Shark script? Sharks & Minnows/Tag EDITED

Basically, i'm making a sharks and minnows game and I need help with figuring out how to write the script. so far i have got this:


local Character = script.Parent.Parent.Character

local humanoid = Character:FindFirstChild("Torso")

 

function Infect(hit)

    if hit.Parent:FindFirstChild("Torso") then

        local player = hit.Parent.Name

        for i,v in pairs(game.Players:GetChildren()) do

            if v.Name == player then

                    if v:FindFirstChild("BackPack") then

                        local pack = v:FindFirstChild("BackPack")

                        if pack:FindFirstChild("IsShark") then

                            local IsShark = pack:FindFirstChild("IsShark")

                                if IsShark == false then

                                    IsShark = true

                                end

EDIT:I'm trying to make the script so that once a round starts, the main script will scan through all the players and if the value in their Backpack (IsShark) is set to true, then it will enable the script I have shown above, which should run a function so that when a 'shark' touches a person who isn't a 'shark' that person will have this script activated and there walkspeed changed

this is a script inside StarterPack and there are two boolValues in starterpack too, IsShark and IsPlaying. I have it so when the IsShark value is changed to true, it should change a players walkspeed and enable this script inside their backpack. However, i have trialed this and it won't work. I'm not too good with scripts like this one and any help would be useful. If you need more information, just ask.This is all in a Normal script**** (in the script, the function and if state,ment ends have been cut off i dont know why)**

2 comments

0

i suppose you do have all the end's in the original?

0

yes, might not of made that too clear

1 answer

When you compare BoolValues in if statements, you need to use .Values. i. e. ~~~~~~~~~~~~~~~~~ if IsShark.Value == true then print("Heh..") end


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