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

Not sure how to tackle this problem?

Asked by 9 years ago

I have a model called ''Pack''. This code makes it dissappear on touch. It isn't working. The model won't turn transparent. There are about 5 parts in the pack model. ** --EVERYTHING IS IN THE RIGHT PLACE AND I HAVE NOTHING WRONG. THIS IS A SCRIPT ISSUE, NOT SOMTHING IN THE WRONG PLACE.--**

Also it is supposed to make a guigo away then do a thing, it's in the script


local checkpoint1 = game.Workspace.Pack function checkpoint1hit(otherPart) print("Checkpoint1 was hit!") print(otherPart.Name) if otherPart ~= nil and otherPart.Parent ~= nil and otherPart.Parent:FindFirstChild("Humanoid")then print("A player hit me!") if not checkpoint1:FindFirstChild(otherPart.Parent.Name)then local playerTag = Instance.new("StringValue") playerTag.Parent = checkpoint1 playerTag.Name = otherPart.Parent.Name end end end function cover() print("Holding Cell") game.Workspace.checkpoint1.Transparency = 1 end checkpoint1.Touched:connect(cover) game.startergui.GUI1.Visible = false Wait(4) game.startergui.GUI2.Visible = true --(THIS IS IN THE RIGHT PLACE DON'T TELL ME IT'S WRONG IT'S GUI WITH TEXT LABEL IT'S NOT WRONG SIMPLE AS THAT)

Then I have a single part, named ''notice'', which is supposed to turn a model VISIBLE. the model won't turn visible.

**THIS SHOULD ONLY GO ON IF THE OTHER ONE IS INVISIBLE

local checkpoint2 = game.Workspace.notice

if game.workspace.Pack.Transparency = 1

function checkpoint2hit(otherPart)
 print("Checkpoint2 was hit!")
 print(otherPart.Name)
 if otherPart ~= nil and otherPart.Parent ~= nil and otherPart.Parent:FindFirstChild("Humanoid")then 
    print("A player hit me!")
    if not checkpoint2:FindFirstChild(otherPart.Parent.Name)then 
        local playerTag = Instance.new("StringValue")
        playerTag.Parent = checkpoint1
        playerTag.Name = otherPart.Parent.Name
end
end
end


function cover()
    print("Holding Cell")
    game.Workspace.checkpoint1.Transparency = 0
end

checkpoint2.Touched:connect(cover)
0
**PLEASE COMMENT IF YOUR COMMENT ISN'T AN ANSWER SO YOU DON'T MAKE IT LOOK LIEK YOU ACTUALLY HAVE AN ANSWER, IT JUST LOOKS STUPID ON YOUR PART TOO**. freshieman 0 — 9y
0
You are aware models don't have a visibility or transparency correct? Bman8765 270 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

I would recommend looking at the output when you script, as studio will tell you the errors. SINCE I HAVE BEEN DOWNVOTED SO MANY TIMES FROM ANNOYING PEOPLE WITH ACTUAL SUGGESTION LIKE THE SENTENCE BEFORE, I CANNOT COMMENT SO I CANNOT GUARANTEE THIS WILL WORK. The first thing is that your model, "Pack", cannot use the touched event. It needs to be used by one of the parts inside the model. If you would like to do all of the parts in the model for the touched event, you can use

childs = checkpoint1:GetChildren()
for i =1, #childs do 
    childs[i].Touched:connect(cover)
end

instead of

checkpoint1.Touched:connect(cover)

The second thing I noticed is that if you want to change someones gui you do not go through startergui. This is a common mistake as this is where you edit guis. StarterGui is a storage place where when a player spawns those guis will appear. So, the script changing the guis will only affect people that respawn. If you want to change only the players guis, you will have to find the player and then use Player.PlayerGui.(if you are using a local script then you can just use local player = game.Players.LocalPlayer but since this is in the workspace a localscript wont run.)

This is all I see at first glance.

AGAIN I CANNOT COMMENT SO DON'T TREAT THIS AS AN ANSWER

Hopes this helps

Ad

Answer this question