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

How to Add Cut scene In Tycoon When You Claim The Tycoon?

I'm wondering how I could add cut scene when you claim your tycoon. So I added a brick if you step on it, it will Play a cut scene. And I added a remove script when you step on it. It works but, you can step on others users tycoon claimer and play the cut scene. Help Please, Here is the door claimer script:

script.Parent.Head.Touched:connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player ~= nil then
		local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
		if PlayerStats ~= nil then
			local ownstycoon = PlayerStats:FindFirstChild("OwnsTycoon")
			if ownstycoon ~= nil then
				if ownstycoon.Value == nil then
					if script.Parent.Parent.Parent.Owner.Value == nil then
						if hit.Parent:FindFirstChild("Humanoid") then
							if hit.Parent.Humanoid.Health > 0 then
								script.Parent.Parent.Parent.Owner.Value = player
								ownstycoon.Value = script.Parent.Parent.Parent
								script.Parent.Name = player.Name.."'s Tycoon"
								script.Parent.Head.Transparency = 0.6
								script.Parent.Head.CanCollide = false
								player.TeamColor = script.Parent.Parent.Parent.TeamColor.Value
							end
						end
					end
				end
			end
		end
	end
end)

And Here is the cut scene brick player scripts

script 1 :

cscript = script.Parent:WaitForChild("CutsceneScript")

if script.Parent:findFirstChild("SkipCutsceneGuiValue") then
	script.Parent.SkipCutsceneGuiValue.Parent = cscript
	script.Parent.SkipCutsceneGui.Parent = cscript
end

debounce = false

function onTouched(hit)
	if debounce == true then return end
	if hit.Parent:findFirstChild("CutsceneScript") then return end -- If theres already a cutscene running, then don't do anything.
	if not hit.Parent:findFirstChild("Humanoid") then return end -- If theres no humanoid,  then don't do anything
	if not game.Players:GetPlayerFromCharacter(hit.Parent) then return end -- If its not a player, then don't do anything.
	debounce = true
	script.Parent.BrickColor = BrickColor.new("Black")
	local cutsceneScript = cscript:clone()
	cutsceneScript.Parent = hit.Parent
	cutsceneScript.Disabled = false
	repeat wait () until cutsceneScript.Parent == nil
	wait(3)
	script.Parent.BrickColor = BrickColor.new("Dark stone grey")
	debounce = false
end

script.Parent.Touched:connect(onTouched)

script 2 :

repeat wait () until game.Workspace.CurrentCamera ~= nil

local c = game.Workspace.CurrentCamera
local data = LoadLibrary("RbxUtility").DecodeJSON(script.CutsceneData.Value)
local rs = game:GetService("RunService").RenderStepped

function tweenCam(c1,f1,time,fov,roll)
	local c0,f0,fv0,r0,frames = c.CoordinateFrame,c.Focus,c.FieldOfView,c:GetRoll(),time/0.015
	for i = 1,frames do
		c.CameraType = "Scriptable"
		c.CoordinateFrame = CFrame.new(c0.p:lerp(c1.p,i/frames),f0.p:lerp(f1.p,i/frames))
		c.FieldOfView = (fv0+(fov-fv0)*(i*(1/frames)))
		c:SetRoll(r0+(roll-r0)*(i*(1/frames)))
		rs:wait()
	end
end

print("Running")
c.CameraSubject = nil	
c.CameraType = "Scriptable"
c.CoordinateFrame = CFrame.new(unpack(data[1].c1))
c.Focus = CFrame.new(unpack(data[1].f1))
c.FieldOfView = data[1].FOV
c:SetRoll(data[1].Roll)
if script:findFirstChild("SkipCutsceneGuiValue") then
	local gui = script.SkipCutsceneGui:clone()
	gui.Parent = game.Players.LocalPlayer.PlayerGui
	gui.Cutscene.Value = script
	gui.Main.Debug.Disabled = false
	script.SkipCutsceneGuiValue.Value = gui
end
for i = 2,#data do
	tweenCam(CFrame.new(unpack(data[i].c1)),CFrame.new(unpack(data[i].f1)),data[i].step,data[i].FOV,data[i].Roll)
end
c.CameraSubject = game.Players.LocalPlayer.Character.Humanoid	
c.CameraType = "Custom"
c.FieldOfView = 70
if script:findFirstChild("SkipCutsceneGuiValue") then
	if script.SkipCutsceneGuiValue.Value ~= nil then
		script.SkipCutsceneGuiValue.Value:Destroy()
	end
end
script:Destroy()

Please Help With The Problom :)

Thank You!

5 comments

0

Free model script.

0

You can use the Cutscene plugin

0

Locally delete the other claim bricks. (If possible)

0

Your question is structured so that it is tailored specifically to the issue you're facing, and you've posted a ton of code which is a common way to show that you haven't done enough research.

0

It is virtually impossible for a stranger who has never seen your scripts to understand what is going on if there is no explanation for them.

1 answer

Not sure exactly in the Workspace your tycoons are, but just check if the player owns the tycoon in script 1

Ex,

cscript = script.Parent:WaitForChild("CutsceneScript")

if script.Parent:findFirstChild("SkipCutsceneGuiValue") then
    script.Parent.SkipCutsceneGuiValue.Parent = cscript
    script.Parent.SkipCutsceneGui.Parent = cscript
end

debounce = false

function onTouched(hit)
    if debounce == true then return end
    if hit.Parent:findFirstChild("CutsceneScript") then return end -- If theres already a cutscene running, then don't do anything.
    if not hit.Parent:findFirstChild("Humanoid") then return end -- If theres no humanoid,  then don't do anything
    if not game.Players:GetPlayerFromCharacter(hit.Parent) then return end -- If its not a player, then don't do anything.
    if game.Players:GetPlayerFromCharacter(hit.Parent).Name ~= OWNER VALUE then return end-- Get the owner name here, checks if the player is the owner of the tycoon, if it's not then don't do anything.
    debounce = true
    script.Parent.BrickColor = BrickColor.new("Black")
    local cutsceneScript = cscript:clone()
    cutsceneScript.Parent = hit.Parent
    cutsceneScript.Disabled = false
    repeat wait () until cutsceneScript.Parent == nil
    wait(3)
    script.Parent.BrickColor = BrickColor.new("Dark stone grey")
    debounce = false
end

script.Parent.Touched:connect(onTouched)

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