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

Help with Shark script (Sharks + Minnows)?

Asked by 7 years ago
Edited 7 years ago

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
                        end
                    end
                else
            end
        end
    end
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

0
What exactly do you want us to help you with? Could you please be more specific. H4X0MSYT 536 — 7y
0
oh, sorry let me edit it turtle2004 167 — 7y

1 answer

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

I see, I copied your script and looked in the Developer Console and one of your variables are the one breaking this code.

"local character = script.Parent.Parent.Character"

I think I would use.

local player = game.Players.LocalPlayer
local character = player.Character

Comment on this and I'll be at the notification.

Ad

Answer this question