#How to make this MA 2 script triggered by touching a part in workspace instead of CharacterAdded?

64 messages · Page 1 of 1 (latest)

short shuttle
#
local db = false
part.Touched:Connect(function()
  if db == false then
  db = true
        local Remote:RemoteEvent = game.ReplicatedStorage.CutsceneRemote
        local CutsceneFolder:Folder = game.ReplicatedStorage.TheBoulder1
        Remote:FireClient(Player, Player.Character.HumanoidRootPart, CutsceneFolder)
task.wait(--[[time you want the cooldown of the part to be, removable]])
db = false
  end
end)
#

@frosty bobcat Is this what you mean?

frosty bobcat
#

Hmm.

#

I pasted this script, the Player at Remote:FireClient is unknown

#

@short shuttle

#

Ignore the red line, that's Grammarly

vernal turret
#

Touch event?

short shuttle
#

wait a sec

frosty bobcat
#

currently trying to add a new variable but i cant do shit

#

This script triggers another local script

#

basically this is a trigger script

#

and Its supposed to be touch trigger rather than a player joining

vernal turret
frosty bobcat
#

ServerScriptService being the parent of this specific script

vernal turret
#

my first time ever seeing a reversed role

frosty bobcat
#

Rkyel did you delete the script accidentally 💀

vernal turret
#

Usually it's local script triggering by server

short shuttle
#
local db = false
part.Touched:Connect(function(hit)
  if game.Players:FindFirstChild(hit.Parent.Name) and hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("Humanoid").Health ~= 0 and db == false then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
  db = true
        local Remote:RemoteEvent = game.ReplicatedStorage.CutsceneRemote
        local CutsceneFolder:Folder = game.ReplicatedStorage.TheBoulder1
        Remote:FireClient(Player, Player.Character.HumanoidRootPart, CutsceneFolder)
task.wait(--[[time you want the cooldown of the part to be, removable]])
db = false
  end
end)
frosty bobcat
#

bruh

#

alright lets see

#

thank ya'll for bothering btw

#

this means a lot 💀

#

Humanoid health 0?

#

is that supposed to trigger it or

#

Im gonna test rn

short shuttle
#

it checks if Humanoid's health isnt equal to 0

#

if you want the cutscene to only play once, remove the db = false

frosty bobcat
#

OH SHIT

#

IT WORKS.

short shuttle
#

I can't believe you when you say you've watched tens of tutorials, you should go watch begginer scripting tutorials

frosty bobcat
#

OH GOD

frosty bobcat
#

dude

#

it works

#

i cannot

#

show you

vernal turret
#

Yay

frosty bobcat
#

enough appreciation.

#

thank you aswell Eddy

vernal turret
#

You may close this post now

frosty bobcat
#

Yea

short shuttle
#

wait

frosty bobcat
#

Thank you both

#

?

vernal turret
short shuttle
frosty bobcat
#

Main issue of mine is I forcely watch intermediate scripting tutorials thinking it's logical

#

but yea thank you for the advice

#

and thank you for the script Rkyiel

short shuttle
#

alright take care, happy new years

frosty bobcat
#

happy new years aswell

#

🫂

vernal turret
#

Once you know what each detail does it's going to be easier dw

frosty bobcat
#

I see

#

alright how do I delete

#

this post again

#

?

vernal turret
#

I just unfollow the post lol

frosty bobcat
#

oh

#

🌝