NEED HELP QUICK how do i make this attribute thing work

How do i do this properly, ive been trying to figure this out for like 12 hours.

what i want to do is for a door to not be opened untill task1 is complete, i finished the task changing becoming true thing in the local script( tell me if i should send) but i cant figure out why it stays false on the server script, the heartbeat is for checking what the attribute is right now, please help me

local ts = game:GetService("TweenService")
local player = game:GetService("Players")
local plr = player.LocalPlayer
local use = script.Parent:WaitForChild("ProximityPrompt")
local callendar = script.Parent
print(use)
print(callendar)
local player = game:GetService("Players").PlayerAdded:Wait()
print(player)
player:SetAttribute("Task1", false)
player:SetAttribute("Task2", false)
player:SetAttribute("Task3", false)
player:SetAttribute("Task4", false)
player:SetAttribute("Task5", false)
player:SetAttribute("Task6", false)
player:SetAttribute("Task7", false)
player:SetAttribute("Task8", false)
player:SetAttribute("Task9", false)
player:SetAttribute("Task9", false)
local rs = game:GetService("RunService")

local taskdone = player:GetAttribute("Task1")
print(taskdone)
local works = game:GetService("StarterGui")

local tween = TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out, 0, false, 0)
local rep = game:GetService("ReplicatedStorage")

local activated = false
local debounce = false
callendar.Orientation = Vector3.new(-90, 0, 0)
callendar.Position = Vector3.new(-123.71, 9.49, -176.33)
local dialoguemod = rep:WaitForChild("Forgot")

rs.Heartbeat:Connect(function()
	
	taskdone = player:GetAttribute("Task1")
	print(taskdone)
end)

use.Triggered:Connect(function(plr, sup, number)
			print(taskdone)
	
	if taskdone == true then return end
	if not taskdone then 
		
		 sup = "I cant forget my necklace, Its on top of my cabinet."
		 number = "0.1"
		 print(sup,number)
		dialoguemod:FireClient(plr, sup, number)
	end
end)


use.Triggered:Connect(function()
	print( "triggered")
	taskdone = player:GetAttribute("Task1")
	if not taskdone then 	return end
		
	
	print(taskdone)
	if not activated and not debounce then
		print("worked")
		debounce = true

		ts:Create(callendar, tween, {Orientation = Vector3.new(-90, -90, 0)}):Play()
		ts:Create(callendar, tween, {Position = Vector3.new(-118.56, 9.49, -171.38)}):Play() 
		task.wait(1)
		activated = true
		debounce = false

	elseif activated and not debounce then
		print("worked")
		debounce = true
		
		ts:Create(callendar, tween, {Orientation = Vector3.new(-90, -0, 0)}):Play()
		
		ts:Create(callendar, tween, {Position = Vector3.new(-123.76, 9.49, -176.58)}):Play()
		task.wait(1)
		activated = false
		debounce = false
	end

end)

---127.6, 10.51, -35.75

Setted it on Server, not client because of replication or RemoteEvent to signal server to Set “Task1” to true (probably not best choice).

You need to get attribute everytime, not setting it to local everytime and printing it (althought it does get updated)

print(player:GetAttribute("Task1"))

(also i notice are you handling whole game on client ?)

Then change value in server, not in client (client and server gonna see it but server will rejected it) or use the RemoteEvent, this is second time i’m saying this about it

oh this was in a server script, i meant there was a local script that was changing it from true or false

Thats the thing, since its a local script, it stays local. As Microlosofto said

therefore, it doesn’t get forwarded to the server.

1 Like

okay i fixed it by doing a server, client, server send thing, i didnt understand what the other guy said earlier xd

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.